The Store represents an ObjectBox database on the local disk. For each persisted object type, you can obtain a
Boxinstance with the
box(for:)method. Boxes provide the interfaces for object persistence.
A typical setup sequence looks like this:
let store = try Store(directoryPath: pathToStoreData) let personBox = store.box(for: Person.self) let persons = try personBox.all()
NoteYou must run the code generator by building at least once to create a Store initializer according to your data model. This generated initializer does not have a “model” parameter (that one is an internal initializer), and comes with convenient defaults for its named parameters.
public class Store : CustomDebugStringConvertible
Base protocol of anything you want to persist in a box.
All stored properties of a type that conforms to
Entitywill be persisted, if possible. For numbers, ObjectBox recognizes
Int(plus their unsigned variants),
Double. It also recognizes
Data(the latter of which may also be written as
Informal requirements: It is assumed that classes implementing this have an init() method and all properties to be serialized are mutable. For struct types, it is assumed that an init method exists that accepts all properties to be serialized.
public protocol Entity
extension Id: UntypedIdBase
Metadata of object properties, used by the framework to determine how to store the values.
These are created by the code generator for you.
Usually, you only deal with this class when writing queries. The property names you use in your queries are actually instances of Property, and you can use operators and comparison methods like isLessThan() on them to express your queries. Below you see a list of methods that are available to you for property queries, apart from the operators described under Query Syntax.See more
public struct Property<E: EntityInspectable & __EntityRelatable, V: EntityPropertyTypeConvertible, R> where E == E.EntityBindingType.EntityType