Installing ObjectBox

Learn how to set up ObjectBox in your project.

Having problems installing ObjectBox using this guide? Please, let us know where we lost you. Thanks for your help!

Adding the ObjectBox Framework to Your Project

While you can set up ObjectBox manually in Xcode, we recommend installation using CocoaPods.

CocoaPods

ObjectBox is installed like any other pod, with the exception of an additional 3rd step:

  1. Add pod 'ObjectBox' to the Podfile in your Xcode project directory.

  2. Run pod install in Terminal.

  3. Run Pods/ObjectBox/setup.rb in Terminal.

  4. Open your .xcworkspace.

Detailed Instructions

If you don't have CocoaPods already, install it by typing sudo gem install cocoapods in Terminal. If you don't have a Podfile yet, cd into your Xcode project folder and create one using pod init as usual. Now find the # Pods for MyTargetName comment for each target and add the following below it:

pod 'ObjectBox'

Then run:

pod repo update
pod install
Pods/ObjectBox/setup.rb

The first call will ensure your local copy of the list of available CocoaPods is current, the second call is your usual procedure when adding a new pod to your Podfile that will download the newest release of ObjectBox to your Pods directory and install the pod in your Xcode workspace.

Once you have ObjectBox downloaded, setup.rb will set up the ObjectBox preprocessor in your project for every target with an executable.

You can now open your project's Xcode workspace as usual and follow the rest of this tutorial.

Swift 5.0: The default version of ObjectBox is built for Swift 5.1, but we provide a special version for Swift 5.0.1 as well. You need to make two adjustments:

  • Add pod 'ObjectBox501'instead of pod 'ObjectBox'.

  • Run the script from Pods/ObjectBox501/setup.rb.