This wizard shows how to setup a Topee-based project from scratch that can be published to the App Store. A Safari App Extension always has to be embedded in a MacOS application and is distributed as a part of the application. If you already have an application that you want to add your App Extension into, you can skip the next two sections.
If you have not done so already, register at developer.apple.com.
Then create your App ID
You also need to define your Provisioning Profiles
In addition to the Mac App Store Provisioning Profile, setup a Mac App Development Provisioning Profile in a similar fashion.
A Safari App Extension needs to be embedded in a MacOS app. If the extension does not need any application to work, such an application usually just leads users to Safari preferences where the extension is enabled manually.
Start Xcode and create the application
Set the project options. Bundle Id can be changed later on.
Ajust the Bundle Id later on to match you the one you have created at developer.apple.com
You might also want to set your deployment target to a slightly lower MacOS version than the default
Xcode has a Safari Extension target that shall be added to your project
There are multiple dependency managers available. This wizard uses carthage. Start a command line in your project directory
echo "github \"https://github.com/avast/topee\" ~> 1.0.0" >> Cartfile
carthage bootstrap
After this, Topee.framework is located in the Carthage/Build/Mac directory. Add it to the Embedded binaries list
Then select the appex target and drag&drop Topee.framework its Linked Frameworks and Libraries list
Then switch to the extension target build phases, add a new Copy Files phase, in the phase, select the Frameworks destination and add Topee.framework to copy.
While in Build settings, find Runpath Search Paths and add @executable_path/../Frameworks
.
You can simply keep your JavaScript and other resources inside the project repository, add it as a git submodule or use Carthage to pull releases.
However, you need to bundle them as resources within your package. You can see this already in the Topee Demo application
To keep your directory structure, it is easier to add a Run Script task to your Build Phases
rsync -rtv $PROJECT_DIR/../../chrome_extension/img/ $BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/img
Now it's time to edit your extension Info.plist as described in xcode.md,
extend TopeeSafariExtensionHandler
and run your extension.
When running it for the first time, go to Safari preferences and enable the extension.