ObjectBox Swift Usage Guide

ObjectBox is an object-oriented lightweight database and a full alternative to SQLite and Core Data.

First steps with ObjectBox for Swift:

If you have any questions, don't hesitate to get in touch! contact [at] objectbox.io

ObjectBox Change Log

1.0 - 2019-09-24

  • Relations in queries

  • Observer callbacks for data changes

  • Many-to-many relations

  • Asynchronous put/remove

  • Edit relations through their backlinks

  • API clean up; e.g. renames, simple IDs, simplifications, etc.

  • If you've been using pre-releases, you can find migration instructions in the Readme on Github.

0.9.1 - 2019-08-13

iOS hotfix

  • Fixed "Storage error code 78" for iOS

0.9.0 - 2019-07-22

Open Source Release

  • Source code for the Swift binding is now available

  • Reduced write/update time by about 25%

  • Rewrote the remaining Objective-C classes in Swift

  • Fix an issue reading an old entity written before a new, non-optional property was added to it

  • Improvements for people using SwiftLint in their projects

  • Added findIds(), visit()/forEach(). Added remove() for queries.

  • Improved support for enums and other user-defined types

  • Data and [UInt8] are now supported as property types.

  • Binaries: Swift 5 ABI only

0.8.0 - 2019-05-14

Struct Support and Performance Improvements

  • Immutable structs can now be used, you are no longer restricted to classes

  • We no longer throw NSError-based errors, they're all enum ObjectBoxError cases now

  • Strings that were created as NSStrings previously are now created as Swift Strings, which should reduce the number of unnecessary UTF-16/UTF-8 roundtrip conversions when Swift 5.1 arrives

  • New projects are now set up with separate generated source files for each target by setup.rb.

  • Binaries: Swift 5 ABI only

0.7.0 - 2019-04-02

Swift 5 and Build Improvements

0.6.0 - 2018-12-19

Model Migration

  • Your data model is now migrated transparently for you when you make changes

  • Properties can be indexed

  • You can require property fields to be unique

  • You can specify a different name for use in the model than the instance variable's

  • Use of ObjectBox without CocoaPods has been simplified

  • You do not need to annotate back-links in relations anymore in clear cases

  • Binaries: Swift 4 ABI only.

  • Alpha users:

    • Use annotations // objectbox: instead of // sourcery:

    • Delete any database files you created before (one time only, starting with the beta we have model migrations)

0.5.5 - 2018-11-29

Alpha 6

  • Remove code-generator limitations regarding order of properties vs. relations

  • Support sandboxed macOS applications (see macOS Sandbox setup)

  • Add "transient" annotation for skipping properties

  • Binaries: Swift 4 ABI only.

0.5.4 - 2018-11-27

Alpha 5

  • Code generation fixes for optionals

  • Expanded example app to demo optionals

  • Fixes for Date-decoding into entities

  • Binaries: Swift 4 ABI only

0.5.3 - 2018-11-26


  • Just small things. Also an elephant.

0.5.2 - 2018-11-22

iOS Sandboxing.

  • Fixed issues that could occur when deploying to device.

  • Added auto-registration of your entities

0.5.1 - 2018-11-19

Alpha 2

  • Fix an issue related to "duplicate index ID" error message.

0.5.0 - 2018-11-16

Alpha 1

  • Initial public release for comment.