iOS
iOS plugins can be written with Swift or Objective C.
To be able to write iOS native plugins, you will need to make sure you are setting your iOS environment to match the correct Zapp SDK
For working with Zapp iOS SDK 12.0 and up please use:
- Xcode version 10.2.1
- Swift version
5.0
- Make sure that your plugin is
bitcode enable
- Install CocoaPods version
1.7.5
For older Zapp iOS SDK versions please use:
- Xcode version 10.1
- Swift version
4.2
- Make sure that your plugin is
bitcode enable
- Install CocoaPods version
1.5.3
Creating a new iOS Plugin
Each plugin is comprised from a git repository including the following:
- Xcode project generating a dynamic library and optionally a demo project
- Cocoapods podspec for the latest version (optionally have a spec directory containing previous versions) generating
- Zapp Plugins Manifest
Example Podfile
Here is an example of a basic podfile to include the dependencies and configurations used by our plugins:
platform :ios, '10.0'
use_frameworks!
install! 'cocoapods', :deterministic_uuids => false
source 'git@github.com:applicaster/CocoaPods.git'
source 'git@github.com:applicaster/PluginsBuilderCocoaPods.git'
source 'https://cdn.cocoapods.org/'
def shared_pods
pod 'ZappPlugins'
pod 'ZappSDK', :path => './ZappPluginExample.podspec'
end
target 'ZappPluginExample-iOS' do
shared_pods
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end
This Podfile references the podspec and will create a structure where the plugin code is imported like a real project as a development pod. Note: The example above uses Swift 4.2. Please choose 4.2 or 5.0 according to the Zapp SDK version you are using for development as mentioned at the top of this document.
Podspec example
Here is a simple example for a podspec for a sample plugin:
Pod::Spec.new do |s|
s.name = "ZappPluginExample-iOS"
s.version = '1.0.0'
s.summary = "An Example of a plugin for Zapp iOS."
s.description = <<-DESC
An Example of a plugin for Zapp iOS.
DESC
s.homepage = "https://github.com/applicaster/ZappPluginExample-iOS"
s.license = 'MIT'
s.author = { "Liviu Romascanu" => "l.romasca@applicaster.com" }
s.source = { :git => "git@github.com:applicaster/ZappPluginExample-iOS.git", :tag => s.version.to_s }
s.platform = :ios, '10.0'
s.requires_arc = true
s.public_header_files = 'ZappPluginExample-iOS/**/*.h'
s.source_files = 'ZappPluginExample-iOS/**/*.{h,m,swift}'
s.resources = [
"ZappPluginExample-iOS/**/*.xcassets",
"ZappPluginExample-iOS/**/*.storyboard",
"ZappPluginExample-iOS/**/*.xib",
"ZappPluginExample-iOS/**/*.png"]
s.xcconfig = { 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
'ENABLE_BITCODE' => 'NO',
'OTHER_LDFLAGS' => '$(inherited)',
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "${PODS_ROOT}"/**',
'LIBRARY_SEARCH_PATHS' => '$(inherited) "${PODS_ROOT}"/**'
}
s.dependency 'ZappPlugins'
end
This podspec will also generate a bundle for the dynamic framework. If this is not needed, feel free to remove the resources section.
Please refer to our Guide for deploying a plugin to cocoapods for instructions regarding the different options of hosting and serving the different podspec files and correctly versioning them.
NOTE: When using private pods and pod repositories - it is mandatory to use SSH - git@github.com/<account>/<dependancy>.git
in the s.source
field, and invite the CI github user to have access to the code. Unfortunatly HTTPS is not properly supported for this use.
Starting a new project
There are a couple of options of starting a new plugin project:
- Use one of the Applicaster examples
- Start a new Cocopod from scratch
- Use an Applicaster Zapp Plugin template to create a new project.
Next Steps
- Applicaster Zapp App Connector utilities for iOS plugins
- Deploy & Submit
- Download a development project