How to convert existing web extensions for Safari – Discover

0
3
How to convert existing web extensions for Safari - Discover

Whenever you create a Safari Internet Extension, you possibly can assist individuals get frequent on-line duties finished extra rapidly and effectively — all whereas utilizing the identical extension mannequin and APIs present in extensions for Google Chrome, Mozilla Firefox, and Microsoft Edge browsers.

When you have an current net extension you’d like to arrange for distribution within the Mac App Retailer, it’s simple to to get began with the converter software in Xcode 12. Right here’s find out how to go about it.



Meet Safari Web Extensions

Whenever you create a Safari Internet Extension, you possibly can assist individuals get frequent on-line duties finished extra rapidly and effectively. We’ll present you find out how to construct a brand new Safari Internet Extension and host it on the App Retailer, in addition to find out how to use the safari-web-extension-converter software emigrate current extensions…

Learn more about Safari App Extensions

Convert an extension

Earlier than getting began, ensure you’ve put in the newest variations of Xcode 12, Command Line Instruments, and Safari 14. When prepared, you possibly can then run the next command within the Terminal app:

xcrun safari-web-extension-converter /path/to/my/extension/

The converter software will seek for your extension’s manifest at ./path/to/my/extension/manifest.json and generate a default configuration in your Xcode challenge. If the configuration seems right, kind sure on the immediate and press the Return key. If not, kind no and you’ll enter the converter software’s interactive mode to customise the configuration.


Be aware: Confirm your keys
Through the conversion course of, safari-web-extension-converter will look via your manifest for any keys that aren’t supported by your put in model of Safari. If Xcode finds any points, the app will show a warning message. In case you obtain this, take into account whether or not the affected keys are vital in your extension to perform. You should still be capable of go away these keys in place and have every part run easily, however remember to check your extension to substantiate.


Modify a transformed extension in Xcode

Safari Internet Extensions require a container app so to simply distribute your extension on the Mac App Retailer. As a part of the conversion course of, Xcode robotically creates and opens a container app challenge that incorporates your extension recordsdata. From right here, you possibly can check your extension, make any crucial code adjustments, replace your extension’s icon, and add your container app for distribution via the Mac App Retailer.

Take a look at, check, and check once more
Whereas inside your Xcode challenge, you possibly can construct and run your extension by both urgent Command-R or the Play button within the higher left portion of the display screen.

Your container app has a button to open Safari Extensions preferences. Choose this button to open Safari and allow your extension within the browser.

Be aware: If that is your first time testing an extension via Xcode, you’ll must allow help for unsigned extensions in Safari. To take action, observe these steps:

  1. Open Safari.
  2. Choose Safari > Preferences.
  3. Navigate to the Superior tab.
  4. Examine the ”Present Develop menu in menu bar” checkbox.
  5. Navigate to the Develop menu and choose ”Permit Unsigned Extensions.” You might have to enter your admin password to make adjustments.

Make any code adjustments
By default, your Xcode challenge references your extension’s current content material in addition to native Swift or Goal-C code to create the container app. After testing, you may make any wanted adjustments to this challenge; any alterations you make will robotically present up as a part of your Safari Internet Extension the subsequent time you construct your Xcode challenge.

Replace your icon
Xcode will use any extension icons listed in your manifest as your app icon, which will even show in your Mac App Retailer itemizing. As a result of Safari Internet Extension icons are usually smaller, nonetheless, you could wish to replace to a higher-resolution model of this picture for the perfect look.

To alter your icons, choose the Belongings.xcassets folder within the Xcode sidebar, then drag the brand new icons into the appropriately-sized picture wells.

Add any extra recordsdata to your Xcode challenge
If you must add extra sources or code recordsdata to your extension after conversion — for instance, photos utilized by your consumer interface or different dependencies missed throughout conversion — additionally, you will must manually embrace these recordsdata in your Xcode challenge.

To take action, choose any extra recordsdata in Finder and drag them into the Assets folder inside your Xcode challenge, positioned within the left sidebar. Uncheck ’Copy gadgets if wanted’ within the file dialog to ensure these recordsdata robotically affiliate together with your app.

Distribute your extension

Whenever you’re able to share your extension, sign up together with your Apple Developer account to App Retailer Join and add the container app to for distribution. Bear in mind to evaluate the App Retailer tips earlier than submitting to the Mac App Retailer; Apple evaluations all extensions and extension updates to confirm they work reliably.

Learn more about submitting extensions to the Mac App Store

LEAVE A REPLY

Please enter your comment!
Please enter your name here