How to create extension for Safari without release the app? - xcode

I now want to write extension for Safari.
But xCode offers me first make the app, and then add the safari extension.
OK, I created an empty application, started writing my extension, but I have a question. Can I release an extension without reference to the application? I do not understand the process.
I want to just create a safari extension, without reference to a particular application, because my product is a Safari extension, not a application.

I know it's late but somebody else might stumble upon this topic and I think the following information can be useful.
It seems that according to Apple's documentation extensions that are created using Safari Extension Builder will not longer be supported: https://developer.apple.com/library/archive/documentation/Tools/Conceptual/SafariExtensionGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009977-CH1-SW1
Developer-signed Safari extensions are not supported in Safari 12. Safari extensions distributed in the Safari Extension Gallery are deprecated, and Safari 12 is the last release to support them. Safari by default will turn off Safari extensions using canLoad. Instead, use Content Blocker extensions. New submissions to the Safari Extensions Gallery will be accepted until the end of 2018.
So the only way seems to be to
Use Safari app extensions to add features to the Safari browser.
https://developer.apple.com/documentation/safariservices/safari_app_extensions:
this looks like the only way to develop an extension as of today (2018), alas.

There are 2 types of Safari extensions: ones that bundled with a Mac app (Safari App Extensions) and standalone extensions. I belive standalone extensions can be created using Safari Extension Builder (avaliable in Develop menu in Safari), without Xcode. You can learn more about Safari extensions here.

As Safari extension Builder is deprecated, you now use Xcode. Simply, a Safari Extension can either be bundled with an app, or standalone. To start a new standalone extension, that is, not part of a desktop app:
Launch Xcode
Choose File > New > Project
Select the template Safari Extension App in the Other section
Click Next (continue through the normal process to develop your Safari Extension)
Alternatively, if you wanted to add a Safari Extension to your existing project:
Launch Xcode
Open your existing app project
Choose File > New > Target
Select the template Safari Extension App in the Other section
Click Next (continue through the normal process to develop your app including Safari Extension)
An example might be Grammarly whereby you can download a desktop client and Safari extension (in a bundle) for macOS, or you may download the extension as a standalone app from App Store.

Related

Mac Catalyst, unable to create a Safari Extension

I've started a new iOS project enabling the option to deploy the same app in macOS (Catalyst). But when I try to create a Safari Extension in macOS, I get the following error
'Safari Extension.appex' is a Safari extension, which is not available when building for Mac Catalyst. You may need to restrict the platforms for which this app extension should be embedded in the target editor.
In the target editor Frameworks, Libraries and Embedded Content I've selected only the macOS platform in my Safari Extension, but I get the same error, any clue?
thanks for your time
I've received an answer from Apple
Embedding a Safari App Extension in a Catalyst app currently isn't
supported. If you could file a piece of Feedback in Feedback Assistant
that would be very helpful. Thanks!
https://forums.developer.apple.com/thread/122485

Create a "Safari App Extension" for macOS application created with Electron?

Since the release of "Safari App Extension" I have toyed around with creating safari app extensions for native applications using xcode. Now however, I'm attempting to create an extension for an application that was built using the Electron Framework.
I'm wondering if this is possible and if anyone has had any luck accomplishing this goal. I'm unsure how to go about initiating the safari app extension without the use of xcode.
For those unfamiliar with "Safari App Extension" you can add one to an existing native project by opening a MacOS application, going to "File->New->Target->Safari Extension" this will then create the extension within your existing application and make the extension available within Safari->Preferences->Extensions.
Thank you for reading.
I'm not secure if what I'm saying it's true, but I think that Safari Extensions are writed with Safari apis and/or a language that it isn't javascript (because, on my old Mac, I needed to install an adblocker app with .app extension). The problem is that Electron is based by Chromium and requires javascript and Chromium based extensions. If you want, however, you can do the inverse.
If you are not expert with Chromium extensions, I suggest to you this link.
P.S.: You can also try to find the same or similar extension that works on Chromium.

Why can I run my signed Safari App Extension on other computers, but not the one I developed it on?

I’ve started a Safari App Extension project, following Apple’s documentation.
I’ve got my (empty) app, and my very minimal extension. I’ve archived the app, signing it with my Developer ID. When I copied the archived app to a friend’s Mac, ran it, and launched Safari, the app extension showed up in the Extensions pane of Safari’s preferences (with the parent app’s icon), and when enabled, worked fine.
However, when I run the app on my Mac (where I developed it), and launch Safari, the app extension does not show up in Safari’s Extensions preference pane unless I check “Allow Unsigned Exceptions” in Safari’s develop menu, as described in this answer — and when it does, it has a generic app icon, rather the parent app’s icon.
Although I hope to eventually make the app and the app extension available to other people, I’m mainly making it for myself. As such, I’d like to be able to use it without having to check “Allow Unsigned Exceptions” every time I start Safari.
How can I make the app extension show up in Safari’s Extensions preference pane on the computer I develop the extension on?
I found a debug version of my app and app extension in my user Library folder:
~/Library/Developer/XCode/DerivedData/{APP_NAME_FOLLOWED_BY_LONG_STRING}/Build/Products/Debug
After deleting the contents of this folder, restarting Safari, and allowing unsigned extensions again, my app extension no longer appeared with the generic icon in Safari’s Extensions preferences.
(I’m a real Xcode newbie, so I’ve no idea if deleting debug builds is a thing that I can/should do via Xcode instead.)
I then archived my app again and ran it, then restarted Safari. Now my app extension shows up in Safari’s Extensions preferences, with its proper icon and everything, and stays enabled between restarts.

How do I load extension on firefox and safari browser?

I have developed extension for chrome and later I made browser specific using gulp.
So I know left with folders.
/Chrome
/Firefox
|-/data/
|-/locale/
|-index.js
|-package.json
/Safari
So for the chrome it was simple drag and drop.
So problem I faced is when I try to load on firefox browser at about:degugger it would reject my extension saying it is corrupt.
For Safari I searched on their website and I found documentation for only using Xcode editor.
Install unpacked extension on Safari
Open Safari
Go to menu Develop->Show Extension Builder (If there is no Develop menu, open Safari Preferences->Advanced, and check Show Develop menu in menu bar)
In Extension Builder window, click + at the left-bottom of the window, then click Add Extension
Select your extension folder (Your extension folder should be named as YourExtName.safariextension)
Now your extension will show at left panel of Extension Builder, you can click Install button to install it
Install unpacked extension on Firefox
Latest version of Firefox support load temporary extensions (Not sure from which version).
Steps:
Navigate to about:debugging
Click Load Temporary Add-on button
Select manifest file of you extension
Safari
Open the Gallery by choosing Safari Extensions from the Safari menu.
Click “Install now" next to the extension that you want to install.
You can also get extensions directly from your favorite developers. When you download an extension from a developer, you get a file that ends with .safariextz. Double-click the file to install the extension. It isn't signed or hosted by Apple, so Safari asks you to confirm that you trust the source and want to install the extension.
Firefox
You need to enable the debug mode check more information here

Add Safari Developer Library to Xcode

Does anybody knows how to add Safari documentation to Xcode 4 (https://developer.apple.com/safari/resources/), so I could use it offline.
I tried to look at adcdocset document
developer.apple.com/rss/adcdocsets.atom
Feed for Xcode 4.1. is
developer.apple.com/rss/com.apple.adc.documentation.AppleXcode4_0.atom
For Lion Core Libraries
developer.apple.com/rss/com.apple.adc.documentation.AppleLion.atom
So I tried to substitute Safari
developer.apple.com/rss/com.apple.adc.documentation.Safari.atom
developer.apple.com/rss/com.apple.adc.documentation.Safari5_0.atom
developer.apple.com/rss/com.apple.adc.documentation.Safari5.atom
But with no luck.
Even tried to use the web url as feed url
https://developer.apple.com/library/safari/
but nothing.
Is it even possible to get the Safari Docs to be viewable offline?
It would be normal to have it in Dashboard, but Dashboard hasn't got documentation browser.
Not sure, but I do think that since Extensions are build directly within Safari and no more in Xcode there is no way to have that documentation loaded in Xcode.
However you can download PDF version from the developer site.

Resources