Manually add the BlackBerry Dynamics SDK to your Swift project
BlackBerry Dynamics SDK
to your Swift
project Follow the steps below if you have an existing project. For new projects, see Create an Objective-C or Swift project with the Xcode template.
- In theLink binary with binariessection orBuildsection of yourXcodeproject, addGD.framework.
- Add the required frameworks and libraries to the project (see Software requirements).
- In your code, import theBlackBerry Dynamics Runtimemodule:import GD.Runtime
- Modify theAppDelegateclass to implement theGDiOSDelegateprotocol to implement ahandleEvent(anEvent:) method:class AppDelegate: UIResponder, UIApplicationDelegate, GDiOSDelegate { [...] func handle(_ anEvent:GDAppEvent) { [...] } }
- Add a variable to yourAppDelegate:var good: GDiOS?
- Add the following code to thedidFinishLaunchingWithOptionsfunction:self.good = GDiOS.sharedInstance() // Get BlackBerry Dynamics shared instance self.good!.delegate = self // Set delegate self.good!.authorize() // Authorize
- In theInfo.plistfile, add the entitlment ID (GDApplicationID) and entitlement version (GDApplicationVersion). For more information, see Using an entitlement ID and version to uniquely identify a BlackBerry Dynamics app.
- Define URL types with the same ID as the bundle ID and URL schemes with the required schemes described in Declaring a URL type to support BlackBerry Dynamics features.
- Enable FIPS linking. See Link for FIPS in Objective-C or C++ and Link for FIPS in Swift.
- AddGDAssets.bundleto theCopy Bundle Resourcesbuild phase inXcode. Verify that the copy of the bundle that is distributed with the framework has been added to the project.
- Build your project.