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. Otherwise, for new
projects, consider using the
BlackBerry Dynamics SDK
Xcode
template described in Create Objective-C or
Swift project with BlackBerry
Dynamics
SDK
Xcode template.- In theLink binary with binariessection orBuildsection of yourXcodeproject, add theGD.framework.
- Add the frameworks and libraries listed in Software requirements to the project.
- In your code, import theBlackBerry Dynamicsruntime module:import GD.Runtime ;
- Modify theAppDelegateclass to implement theGDiOSDelegateprotocol to implement ahandleEvent(anEvent:) method, as shown here:class AppDelegate: UIResponder, UIApplicationDelegate, GDiOSDelegate { [...] func handleEvent(anEvent: GDAppEvent!) { [...] } }
- Add a variable to yourAppDelegate:var good: GDiOS?
- Add the following code to thedidFinishLaunchingWithOptionsfunction:self.window = GDiOS.sharedInstance().getWindow() // Replace window with GDWindow self.good = GDiOS.sharedInstance() // GetBlackBerry Dynamicsshared instance self.good!.delegate = self // Set delegate self.good!.authorize() // Authorize
- Modify the app'sInfo.plistfile to include the proper values forGDApplicationIDandGDApplicationVersion, as described in BlackBerry Dynamics entitlement ID and version.
- Define URL types with the same ID as the bundle ID, and URL schemes with the required discovery schemes detailed in Required build-time declarations: URL type (and any other discovery schemes required by your app).
- Enable FIPS Linking (see Link for FIPS in Swift).
- Include the GDAssets.bundle in the build phase (see GDAssets.bundle required in build phase).
- Build your project.