Skip to main content

Getting started

The Fundamentals section of this documentation provides a tour of the most important aspects of the ROOK SDK. It covers everything you need to know to integrate us into your application.

Minimum requirements

  • ios >= 13.0
  • XCode >= 14.2

Installation

Swift Package Manager

  1. To add a package dependency to your Xcode project, select File > Swift Packages > Add Package
  2. In the prompt that appears, select the Rook GitHub repository:
https://github.com/RookeriesDevelopment/rook-ios-sdk.git
  1. Select the version of Rook you want to use. For new projects, we recommend using the newest version of Rook.

Once you finish, Xcode will begin resolving your package dependencies and downloading them in the background.

Cocoapods

Firebase supports installation with CocoaPods in addition to Swift Package Manager.

ROOK's CocoaPods distribution requires Xcode 14.2 and CocoaPods 1.12.0 or higher. Here's how to install ROOK using CocoaPods:

  1. Create a Podfile if you don't already have one. From the root of your project directory, run the following command:
pod init
  1. To your Podfile, add the Rook pod to use in your app.
  pod "RookSDK"
  1. Install the pods, then open your .xcworkspace file to see the project in Xcode:
pod install --repo-update
open your-project.xcworkspace

Configure Project

We need to add Apple Health Kit Framework to our project in order to that please:

  1. Open your project in Xcode.

  2. Click on your project file in the Project Navigator.

  3. Select your target and then click on the "Signing Capabilities" tab.

  4. Click on "Add Capability" and search for "HealthKit"

  5. Enable Background delivery

  6. Click on "Add Capability" and search for "Background Modes"

  7. Enable Background fetch from Background Modes.

rook_connect_configuraiton

Additionally add the following to the info.plist

<key>NSHealthShareUsageDescription</key>
<string>This app requires access to your health and fitness data in order to track your workouts and activity levels.</string>
<key>NSHealthUpdateUsageDescription</key>
<string>This app requires permission to write healt data to HealthKit.</string>

Initialize Rook in your app

RookConnectConfigurationManager Use this class to configure and Init the sdk. This class conforms the singleton pattern, to access this class use the shared property.

It is recommended to configure and init rook sdk in in your app delegate's application(_:didFinishLaunchingWithOptions:) method:

func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
RookConnectConfigurationManager.shared.setEnvironment(.sandbox)
RookConnectConfigurationManager.shared.setConfiguration(
clientUUID: "YOUR-CLIENT-UUID",
secretKey: "YOUR-SECRET-KEY",
enableBackgroundSync: true,
enableEventsBackgroundSync: true)
RookConnectConfigurationManager.shared.initRook()
return true
}