diff --git a/Package.swift b/Package.swift index 297dc9a..d4056fc 100644 --- a/Package.swift +++ b/Package.swift @@ -1,7 +1,7 @@ -// swift-tools-version:5.3 - +// swift-tools-version:5.7 + import PackageDescription - + let package = Package( name: "ObjectBox", platforms: [ @@ -15,8 +15,8 @@ let package = Package( targets: [ .binaryTarget( name: "ObjectBox", - url: "https://github.com/objectbox/objectbox-swift/releases/download/v1.7.0/ObjectBox-xcframework-1.7.0.zip", - checksum: "fb842c0ccd86a81b0640bc2dc1eee39d36528fcfc8e0af51396a45e4af7db004" + url: "https://github.com/objectbox/objectbox-swift/releases/download/v1.8.1/ObjectBox-xcframework-1.8.1.zip", + checksum: "d4f6d9caed7ae2808b15b81b769ad48e47c78d8abb882ff6fa8938cda7cf864c" ) ] ) diff --git a/README.md b/README.md index 8bc02f5..261d11d 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,7 @@ Here's a list of ObjectBox releases, and the Swift versions they were compiled w | ObjectBox version(s) | Swift version | |:--------------------:|:-------------:| +| 1.8.1 | 5.7.2 | | 1.8.0 | 5.7.1 | | 1.7.0 | 5.5 | | 1.6.0 | 5.4 | diff --git a/Source/external/objectbox-swift-generator b/Source/external/objectbox-swift-generator index 9f4fc82..ae2a8fb 160000 --- a/Source/external/objectbox-swift-generator +++ b/Source/external/objectbox-swift-generator @@ -1 +1 @@ -Subproject commit 9f4fc829feb5d5a537aade24ef926f4269063ac5 +Subproject commit ae2a8fb9dbe4ee61df9e7072f369427b93dad8e5 diff --git a/Source/fetch_dependencies.command b/Source/fetch_dependencies.command index 91c2c0b..bdac0d2 100755 --- a/Source/fetch_dependencies.command +++ b/Source/fetch_dependencies.command @@ -88,8 +88,8 @@ if [ -d "$code_dir" ] && [ "$staging_repo" != "true" ]; then # Do we have an exi popd else # Download static public release and unzip into $dest if [ ! -d "${dest_dir}" ] || [ ! -e "${dest_dir}/libObjectBoxCore-iOS.a" ]; then - version=1.8.0 - c_version=0.18.0 + version=1.8.1 + c_version=0.18.1 archive_path="${my_dir}/external/objectbox-static.zip" if [ "$staging_repo" == "true" ]; then release_url_path="https://github.com/objectbox/objectbox-swift-spec-staging/releases/download/v1.x" diff --git a/Source/ios-framework/CommonSource/Box.swift b/Source/ios-framework/CommonSource/Box.swift index 94b528a..6350ad2 100644 --- a/Source/ios-framework/CommonSource/Box.swift +++ b/Source/ios-framework/CommonSource/Box.swift @@ -1,5 +1,5 @@ // -// Copyright © 2018-2020 ObjectBox Ltd. All rights reserved. +// Copyright © 2018-2023 ObjectBox Ltd. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/Source/ios-framework/CommonSource/Store.swift b/Source/ios-framework/CommonSource/Store.swift index 15720ee..f0c352c 100644 --- a/Source/ios-framework/CommonSource/Store.swift +++ b/Source/ios-framework/CommonSource/Store.swift @@ -1,5 +1,5 @@ // -// Copyright © 2019-2022 ObjectBox Ltd. All rights reserved. +// Copyright © 2019-2023 ObjectBox Ltd. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ public class Store: CustomDebugStringConvertible { internal(set) public var directoryPath: String /// Returns the version of ObjectBox Swift. - public static var version = "1.8.0" + public static var version = "1.8.1" /// Returns the versions of ObjectBox Swift, the ObjectBox lib, and ObjectBox core. public static var versionAll: String { @@ -191,7 +191,9 @@ public class Store: CustomDebugStringConvertible { public func closeAndDeleteAllFiles() throws { self.close() obx_remove_db_files(directoryPath) - try FileManager.default.removeItem(at: URL(fileURLWithPath: directoryPath)) + if FileManager.default.fileExists(atPath: directoryPath) { + try FileManager.default.removeItem(atPath: directoryPath) + } } internal let setUpMutexIdentifier: Bool = { diff --git a/Source/ios-framework/CommonTests/BoxTests.swift b/Source/ios-framework/CommonTests/BoxTests.swift index df06ef0..626afec 100644 --- a/Source/ios-framework/CommonTests/BoxTests.swift +++ b/Source/ios-framework/CommonTests/BoxTests.swift @@ -1,5 +1,5 @@ // -// Copyright © 2019 ObjectBox Ltd. All rights reserved. +// Copyright © 2019-2023 ObjectBox Ltd. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -25,66 +25,66 @@ enum BoxTestError: Error { } class BoxTests: XCTestCase { - + var store: Store! - + override func setUp() { super.setUp() - store = StoreHelper.tempStore(model: createTestModel()) + store = StoreHelper.tempStore(model: createTestModel(), maxDbSizeInKByte: 200 * 1024) } - + override func tearDown() { try! store?.closeAndDeleteAllFiles() store = nil super.tearDown() } - + func testGetNonexistingIDInEmptyBox() { let box: Box = store.box(for: TestPerson.self) - + XCTAssertEqual(try box.count(), 0) XCTAssertNil(try box.get(EntityId(12345))) } - + func testPutGet() throws { let box: Box = store.box(for: TestPerson.self) - + XCTAssertEqual(try box.count(), 0) - + let person1 = TestPerson(name: "Søren🙈", age: 42) let person1Id = try box.put(person1) - + XCTAssertNotEqual(person1Id.value, 0) XCTAssertEqual(try box.count(), 1) - + let person2 = TestPerson(name: "κόσμε", age: 40) let person2Id = try box.put(person2) - + XCTAssertNotEqual(person2Id.value, 0) XCTAssertEqual(try box.count(), 2) - + XCTAssertNotEqual(person1Id, person2Id) - + let fetchedPerson1 = try box.get(person1Id) XCTAssertNotNil(fetchedPerson1) XCTAssertEqual(fetchedPerson1?.name, person1.name) XCTAssertEqual(fetchedPerson1?.age, person1.age) - + let fetchedPerson2 = try box.get(person2Id) XCTAssertNotNil(fetchedPerson2) XCTAssertEqual(fetchedPerson2?.name, person2.name) XCTAssertEqual(fetchedPerson2?.age, person2.age) } - + func testGetArrayAndDictionary() throws { let box: Box = store.box(for: TestPerson.self) - + XCTAssertEqual(try box.count(), 0) - + let person1Id = try box.put(TestPerson(name: "Foo", age: 55)) let person2Id = try box.put(TestPerson(name: "Bar", age: 66)) let person3Id = try box.put(TestPerson(name: "Baz", age: 77)) - + XCTAssertNotEqual(person1Id.value, 0) XCTAssertNotEqual(person2Id.value, 0) XCTAssertNotEqual(person3Id.value, 0) @@ -95,17 +95,17 @@ class BoxTests: XCTestCase { let objects1 = try box.get([42, 27, person3Id.value, person1Id.value], maxCount: 1) XCTAssertEqual(["Baz"], objects1.map { $0.name }) - + let entitiesById = try box.getAsDictionary([person3Id, person1Id]) XCTAssertEqual(entitiesById.count, 2) XCTAssertEqual(entitiesById[person1Id]?.name, "Foo") XCTAssertNil(entitiesById[person2Id]) XCTAssertEqual(entitiesById[person3Id]?.name, "Baz") } - + func testPutGet_AllPropertyTypes() throws { let box: Box = store.box(for: AllTypesEntity.self) - + let entity = AllTypesEntity() entity.boolean = true entity.integer = Int32.max - 10 @@ -113,12 +113,12 @@ class BoxTests: XCTestCase { entity.aDouble = 12345.9876 entity.date = Date(timeIntervalSince1970: 1234567890) entity.string = "a string" - + let entityId = try box.put(entity) - + XCTAssertNotEqual(entityId.value, 0) XCTAssertEqual(try box.count(), 1) - + let fetchedEntity = try box.get(entityId) XCTAssertNotNil(fetchedEntity) XCTAssertEqual(fetchedEntity?.boolean, entity.boolean) @@ -128,17 +128,17 @@ class BoxTests: XCTestCase { XCTAssertEqual(fetchedEntity?.date, entity.date) XCTAssertEqual(fetchedEntity?.string, entity.string) } - - + + func testPutGet_Dates() throws { let box: Box = store.box(for: AllTypesEntity.self) - + try box.put([AllTypesEntity.create(date: Date(timeIntervalSince1970: 0)), AllTypesEntity.create(date: Date(timeIntervalSince1970: 1)), AllTypesEntity.create(date: Date(timeIntervalSince1970: 2))]) - + XCTAssertEqual(try box.count(), 3) - + let allEntities = try box.all() XCTAssertEqual(allEntities.count, 3) XCTAssert(allEntities.contains(where: { obj -> Bool in @@ -154,31 +154,31 @@ class BoxTests: XCTestCase { func testPutGetStruct() throws { let box: Box = store.box(for: StructEntity.self) - + XCTAssertEqual(try box.count(), 0) - + let entity1 = StructEntity(id: EntityId(0), message: "Carol Kaehler wrote the docs.", - date: Date(timeIntervalSince1970: -500)) + date: Date(timeIntervalSince1970: -500)) let entity1Id = try box.put(entity1) - + XCTAssertNotEqual(entity1Id.value, 0) XCTAssertEqual(try box.count(), 1) - + let entity2 = StructEntity(id: EntityId(0), - message: "Kristee Kreitman and Marge Boots did the art 👩‍🎨", - date: Date(timeIntervalSince1970: 900)) + message: "Kristee Kreitman and Marge Boots did the art 👩‍🎨", + date: Date(timeIntervalSince1970: 900)) let entity2Written = try box.put(struct: entity2) - + XCTAssertNotEqual(entity2Written.id.value, 0) XCTAssertEqual(try box.count(), 2) - + XCTAssertNotEqual(entity1Id, entity2Written.id) - + let fetchedEntity1 = try box.get(entity1Id) XCTAssertNotNil(fetchedEntity1) XCTAssertEqual(fetchedEntity1?.message, entity1.message) XCTAssertEqual(fetchedEntity1?.date, entity1.date) - + let fetchedEntity2 = try box.get(entity2Written.id) XCTAssertNotNil(fetchedEntity2) XCTAssertEqual(fetchedEntity2?.message, entity2.message) @@ -187,63 +187,63 @@ class BoxTests: XCTestCase { func testPutInWriteTransactionRollback() throws { let box: Box = store.box(for: TestPerson.self) - + XCTAssertEqual(try box.count(), 0) - + XCTAssertThrowsError(try store.runInTransaction { try box.put(TestPerson.irrelevant) - + throw BoxTestError.generalError }) - + XCTAssertEqual(try box.count(), 0) } - + func testPutSameEntityTwice() throws { let box: Box = store.box(for: TestPerson.self) - + let person = TestPerson(name: "Ryu", age: 20) - + let firstPersonId = try box.put(person) XCTAssertNotEqual(firstPersonId.value, 0) - + let secondPersonId = try box.put(person) XCTAssertNotEqual(secondPersonId.value, 0) XCTAssertEqual(secondPersonId, firstPersonId) } - + func testNestedWriteTransactionRollback() throws { let box: Box = store.box(for: TestPerson.self) - + XCTAssertEqual(try box.count(), 0) - + XCTAssertThrowsError(try store.obx_runInTransaction(writable: true, { _ in try box.put(TestPerson.irrelevant) - + try store.obx_runInTransaction(writable: true, { _ in try box.put(TestPerson.irrelevant) - + throw BoxTestError.generalError2 }) })) - + XCTAssertEqual(try box.count(), 0) } - + func testWriteAfterTransactionFailureIsRolledBack() throws { let box: Box = store.box(for: TestPerson.self) - + XCTAssertEqual(try box.count(), 0) - + XCTAssertThrowsError(try store.obx_runInTransaction(writable: true, { _ in try store.obx_runInTransaction(writable: true, { _ in throw BoxTestError.generalError2 }) - + XCTAssertNoThrow(try box.put(TestPerson.irrelevant)) })) - + // TODO: Should the put itself be aborted or error-out? (Would need an early exit flag like isClosed) XCTAssertEqual(try box.count(), 0) } @@ -289,47 +289,47 @@ class BoxTests: XCTestCase { func testPutGetAllRemoveAll() throws { let box: Box = store.box(for: TestPerson.self) - + // Precondition XCTAssertEqual(try box.count(), 0) - + let count = 100 var persons = [TestPerson]() - for i in 0 ..< count { + for i in 0.. Bool in return (obj1.name ?? "").compare(obj2.name ?? "", options: .numeric) == .orderedAscending } - for i in 0 ..< count { + for i in 0.. = store.box(for: TestPerson.self) - + XCTAssertEqual(try box.count(limit: 0), 0) // 0 == no limit XCTAssertEqual(try box.count(limit: 1), 0) XCTAssertEqual(try box.count(limit: 10000), 0) let count = 100 var persons = [TestPerson]() - for i in 0 ..< count { + for i in 0.. = store.box(for: TestPerson.self) - + XCTAssertEqual(try box.count(), 0) let person1Id = try box.put(TestPerson(name: "🤢", age: 123)) @@ -351,7 +351,7 @@ class BoxTests: XCTestCase { XCTAssertEqual(try box.count(), 2) XCTAssertNotEqual(person1Id, person2Id) - + XCTAssertNoThrow(try box.remove(person2Id)) XCTAssertEqual(try box.count(), 1) XCTAssertEqual(try box.all().first?.name, "🤢") @@ -359,14 +359,14 @@ class BoxTests: XCTestCase { func testContains() throws { let box: Box = store.box(for: TestPerson.self) - + var persons = [TestPerson]() - for i in 0 ..< 10 { + for i in 0..<10 { persons.append(TestPerson(name: "Johnny \(i)", age: i)) } - + try box.put(persons) - + XCTAssert(try box.contains(persons[2].id)) XCTAssert(try box.contains([persons[6].id, persons[2].id, persons[5].id, persons[8].id])) try box.remove(persons[5].id) @@ -374,17 +374,17 @@ class BoxTests: XCTestCase { } // MARK: - visiting - + func testForEach() throws { let box: Box = store.box(for: TestPerson.self) - + var persons = [TestPerson]() - for i in 0 ..< 10 { + for i in 0..<10 { persons.append(TestPerson(name: "Johnny \(i)", age: i)) } - + try box.put(persons) - + var personCount = 0 try box.forEach { person in let currPerson = persons.first { $0.age == person.age } @@ -393,17 +393,17 @@ class BoxTests: XCTestCase { } XCTAssertEqual(persons.count, personCount) } - + func testForEachThrows() throws { let box: Box = store.box(for: TestPerson.self) - + var persons = [TestPerson]() - for i in 0 ..< 4 { + for i in 0..<4 { persons.append(TestPerson(name: "Johnny \(i)", age: i)) } - + try box.put(persons) - + var currAge = 0 XCTAssertThrowsError(try box.forEach { person in XCTAssertEqual(currAge, person.age) @@ -412,17 +412,17 @@ class BoxTests: XCTestCase { }) XCTAssertEqual(1, currAge) } - + func testVisit() throws { let box: Box = store.box(for: TestPerson.self) - + var persons = [TestPerson]() - for i in 0 ..< 10 { + for i in 0..<10 { persons.append(TestPerson(name: "Johnny \(i)", age: i)) } - + try box.put(persons) - + var currAge = 0 try box.visit { person in XCTAssertEqual(currAge, person.age) @@ -431,17 +431,17 @@ class BoxTests: XCTestCase { } XCTAssertEqual(5, currAge) } - + func testVisitThrows() throws { let box: Box = store.box(for: TestPerson.self) - + var persons = [TestPerson]() - for i in 0 ..< 2 { + for i in 0..<2 { persons.append(TestPerson(name: "Johnny \(i)", age: i)) } - + try box.put(persons) - + var currAge = 0 XCTAssertThrowsError(try box.visit { person in XCTAssertEqual(currAge, person.age) @@ -453,14 +453,14 @@ class BoxTests: XCTestCase { func testForIn() throws { let box: Box = store.box(for: TestPerson.self) - + var persons = [TestPerson]() - for i in 0 ..< 10 { + for i in 0..<10 { persons.append(TestPerson(name: "Johnny \(i)", age: i)) } - + try box.put(persons) - + var personCount = 1 try box.for(persons.map { $0.id }.dropFirst().dropLast()) { person in let currPerson = persons.first { $0.age == person?.age } @@ -469,17 +469,17 @@ class BoxTests: XCTestCase { } XCTAssertEqual(persons.count - 1, personCount) } - + func testForInThrows() throws { let box: Box = store.box(for: TestPerson.self) - + var persons = [TestPerson]() - for i in 0 ..< 4 { + for i in 0..<4 { persons.append(TestPerson(name: "Johnny \(i)", age: i)) } - + try box.put(persons) - + var personCount = 1 XCTAssertThrowsError(try box.for(persons.map { $0.id }.dropFirst().dropLast()) { person in let currPerson = persons.first { $0.age == person?.age } @@ -489,17 +489,17 @@ class BoxTests: XCTestCase { }) XCTAssertEqual(2, personCount) } - + func testVisitIn() throws { let box: Box = store.box(for: TestPerson.self) - + var persons = [TestPerson]() - for i in 0 ..< 10 { + for i in 0..<10 { persons.append(TestPerson(name: "Johnny \(i)", age: i)) } - + try box.put(persons) - + var personCount = 1 try box.visit(persons.map { $0.id }.dropFirst().dropLast()) { person in let currPerson = persons.first { $0.age == person?.age } @@ -509,40 +509,40 @@ class BoxTests: XCTestCase { } XCTAssertEqual(5, personCount) } - + func testVisitInThrows() throws { let box: Box = store.box(for: TestPerson.self) - + var persons = [TestPerson]() - for i in 0 ..< 4 { + for i in 0..<4 { persons.append(TestPerson(name: "Johnny \(i)", age: i)) } - + try box.put(persons) - + var personCount = 1 XCTAssertThrowsError(try box.visit(persons.map { $0.id }.dropFirst().dropLast()) { person in let currPerson = persons.first { $0.age == person?.age } XCTAssertEqual(currPerson?.age, person?.age) personCount += 1 throw BoxTestError.generalError - }) + }) XCTAssertEqual(2, personCount) } - + func testBoxDescription() throws { let box: Box = store.box(for: TestPerson.self) - + let debugDescription = "\(box)" XCTAssert(debugDescription.hasPrefix(" = store.box(for: TestPerson.self) - + var subscription: Observer - + let group = DispatchGroup() group.enter() let queue = DispatchQueue(label: "io.objectbox.BoxSubscriptionQueue") @@ -554,41 +554,41 @@ class BoxTests: XCTestCase { let person1 = TestPerson(name: "Søren🙈", age: 42) try box.put(person1) - + let person2 = TestPerson(name: "κόσμε", age: 40) try box.put(person2) - + print("Adding sequence point") let allPersons = [person1, person2] - + queue.async { group.leave() } - + print("Waiting") group.wait() - + print("Checking") XCTAssertEqual(results.count, 3) - - for i in 0 ... 2 { + + for i in 0...2 { let persons = (i < results.count) ? results[i] : [] XCTAssertEqual(persons.count, i) let expectedPersons = (i > 0) ? Array(allPersons[.. = store.box(for: TestPerson.self) - + var subscription: Observer - + let person1 = TestPerson(name: "Søren🙈", age: 42) try box.put(person1) - + let group = DispatchGroup() group.enter() let queue = DispatchQueue(label: "io.objectbox.BoxSubscriptionQueue") @@ -599,26 +599,26 @@ class BoxTests: XCTestCase { let person2 = TestPerson(name: "κόσμε", age: 40) try box.put(person2) - + queue.async { group.leave() } - + print("Checking") XCTAssertEqual(results.count, 1) - + let persons = results[0] XCTAssertEqual(persons.count, 1) XCTAssert(persons == [person1]) - + subscription.unsubscribe() } func testBoxSubscriptionNoInitial() throws { let box: Box = store.box(for: TestPerson.self) - + var subscription: Observer - + let group = DispatchGroup() group.enter() let queue = DispatchQueue(label: "io.objectbox.BoxSubscriptionQueue") @@ -629,36 +629,36 @@ class BoxTests: XCTestCase { let person1 = TestPerson(name: "Søren🙈", age: 42) try box.put(person1) - + let person2 = TestPerson(name: "κόσμε", age: 40) try box.put(person2) - + print("Adding sequence point") let allPersons = [person1, person2] - + queue.async { group.leave() } - + print("Waiting") group.wait() - + print("Checking") XCTAssertEqual(results.count, 2) - - for i in 1 ... 2 { + + for i in 1...2 { let persons = (i <= results.count) ? results[i - 1] : [] XCTAssertEqual(persons.count, i) let expectedPersons = (i > 0) ? Array(allPersons[.. = store.box(for: TestPerson.self) - + let person1 = TestPerson(name: "Jesse Faden", age: 29) let person2 = TestPerson(name: "Κασσάνδρα", age: 1000) let person3 = TestPerson(name: "Samus Aran", age: 33) @@ -668,20 +668,20 @@ class BoxTests: XCTestCase { try box.put(person1, person2, person3, person4, person5, person6) XCTAssertEqual(try box.count(), 6) - + try box.remove(person1, person3) XCTAssertEqual(try box.count(), 4) - + try box.remove(person4.id, person2.id) XCTAssertEqual(try box.count(), 2) - + try box.remove(person5.id.value, person6.id.value) XCTAssertEqual(try box.count(), 0) } - + func testCollectionPutCall() throws { let box: Box = store.box(for: TestPerson.self) - + let person1 = TestPerson(name: "Jesse Faden", age: 29) let person2 = TestPerson(name: "Κασσάνδρα", age: 1000) let persons: Set = [person1, person2] @@ -696,30 +696,30 @@ class BoxTests: XCTestCase { XCTAssertEqual(try box.count(), 0) var entity1 = StructEntity(id: EntityId(0), message: "Carol Kaehler wrote the docs.", - date: Date(timeIntervalSince1970: -500)) + date: Date(timeIntervalSince1970: -500)) _ = try box.put(&entity1) XCTAssertNotEqual(entity1.id.value, 0) XCTAssertEqual(try box.count(), 1) } - - + + func testPutModifiableStructs() throws { let box: Box = store.box(for: StructEntity.self) - + XCTAssertEqual(try box.count(), 0) - + var entities = [ StructEntity(id: EntityId(0), message: "Woke up.", - date: Date(timeIntervalSince1970: 600)), + date: Date(timeIntervalSince1970: 600)), StructEntity(id: EntityId(0), message: "Brushed my teeth.", - date: Date(timeIntervalSince1970: 1600)), + date: Date(timeIntervalSince1970: 1600)), StructEntity(id: EntityId(0), message: "Went to the subway.", - date: Date(timeIntervalSince1970: 2600)) + date: Date(timeIntervalSince1970: 2600)) ] try box.put(&entities) - + XCTAssertNotEqual(entities[0].id.value, 0) XCTAssertNotEqual(entities[0].id.value, entities[1].id.value) XCTAssertNotEqual(entities[1].id.value, 0) @@ -731,30 +731,67 @@ class BoxTests: XCTestCase { func testInsert() throws { let box: Box = store.box(for: TestPerson.self) - + let person1 = TestPerson(name: "Darth Savik", age: 42) let person1Id = try box.put(person1, mode: .insert) - + XCTAssertNotEqual(person1Id.value, 0) XCTAssertEqual(try box.count(), 1) - + let person2 = TestPerson(name: "Satele Shan", age: 40) person2.id = person1Id XCTAssertThrowsError(try box.put(person2, mode: .insert)) } - + func testUpdate() throws { let box: Box = store.box(for: TestPerson.self) - + let person1 = TestPerson(name: "Darth Savik", age: 42) XCTAssertThrowsError(try box.put(person1, mode: .update)) let person1Id = try box.put(person1, mode: .insert) - + XCTAssertNotEqual(person1Id.value, 0) XCTAssertEqual(try box.count(), 1) - + let person2 = TestPerson(name: "Satele Shan", age: 40) person2.id = person1Id XCTAssertNoThrow(try box.put(person2, mode: .update)) } + + func testUniqueViolated() throws { + let box: Box = store.box(for: UniqueEntity.self) + try box.put(UniqueEntity(name: "same")) + XCTAssertThrowsError(try box.put(UniqueEntity(name: "same"))) { error in + let obxErr = error as? ObjectBoxError + XCTAssertNotNil(obxErr) + } + try box.put(UniqueEntity(name: "not same")) + } + + func testUniqueBulk() throws { + let box: Box = store.box(for: UniqueEntity.self) + let extensive = false // Switch to true locally for extensive testing that takes longer + let count = extensive ? 10000 : 1000 + var objects = [UniqueEntity]() + + for run in 1...(extensive ? 10 : 1) { + print("Run #", run) + objects.removeAll() + try box.removeAll() + XCTAssertEqual(try box.count(), 0) + + for i in 0.. Store { + public class func tempStore(model: OpaquePointer /*OBX_model*/, maxDbSizeInKByte: UInt64 = 500) -> Store { let directoryPath = StoreHelper.newTemporaryDirectory().path var store: Store! = nil do { - store = try Store(model: model, directory: directoryPath, maxDbSizeInKByte: 500, fileMode: 0o644, - maxReaders: 10) + store = try Store(model: model, directory: directoryPath, maxDbSizeInKByte: maxDbSizeInKByte, + fileMode: 0o644, maxReaders: 10) } catch { NSException(name: NSExceptionName.genericException, reason: "tempStore failed with error: \(error)", userInfo: [NSUnderlyingErrorKey: error]).raise() diff --git a/Source/ios-framework/CommonTests/Helpers/TestEntities.swift b/Source/ios-framework/CommonTests/Helpers/TestEntities.swift index 2579bf1..17860fe 100644 --- a/Source/ios-framework/CommonTests/Helpers/TestEntities.swift +++ b/Source/ios-framework/CommonTests/Helpers/TestEntities.swift @@ -35,16 +35,16 @@ public class TestPerson: CustomDebugStringConvertible { var id: EntityId = 0 var name: String? var age: Int - + static var irrelevant: TestPerson { return TestPerson(name: "Irrelevant", age: 123) } - + init(name: String? = nil, age: Int = 0) { self.name = name self.age = age } - + public var debugDescription: String { return "TestPerson(\(id.value): \(name ?? "") @\(age))" } @@ -69,31 +69,31 @@ public class AllTypesEntity { public var aDouble: Double = 0 public var date: Date? public var string: String? - + static func create(integer: Int32, double: Double, string: String) -> AllTypesEntity { let newEntity = AllTypesEntity() - + newEntity.integer = integer newEntity.aDouble = double newEntity.string = string - + return newEntity } - + static func create(long: Int) -> AllTypesEntity { let newEntity = AllTypesEntity() - + newEntity.aLong = long - + return newEntity } - + static func create(integer: Int32) -> AllTypesEntity { let newEntity = AllTypesEntity() newEntity.integer = integer return newEntity } - + static func create(unsigned: UInt32) -> AllTypesEntity { let newEntity = AllTypesEntity() newEntity.unsigned = unsigned @@ -105,19 +105,19 @@ public class AllTypesEntity { newEntity.aDouble = double return newEntity } - + static func create(date: Date) -> AllTypesEntity { let newEntity = AllTypesEntity() newEntity.date = date return newEntity } - + static func create(string: String?) -> AllTypesEntity { let newEntity = AllTypesEntity() newEntity.string = string return newEntity } - + static func create(boolean: Bool) -> AllTypesEntity { let newEntity = AllTypesEntity() newEntity.boolean = boolean @@ -129,7 +129,7 @@ public class AllTypesEntity { // swiftlint:disable identifier_name force_try public func createTestModel(syncEnabled: Bool = false) -> OpaquePointer { let modelBuilder = try! ModelBuilder() - + let allTypesEntityBuilder = try! modelBuilder.entityBuilder(for: AllTypesEntity.self, id: 1, uid: 1000) if syncEnabled { try! allTypesEntityBuilder.flags(.syncEnabled) @@ -155,9 +155,77 @@ public func createTestModel(syncEnabled: Bool = false) -> OpaquePointer { try! structEntityBuilder.addProperty(name: "message", type: .string, id: 2, uid: 13) try! structEntityBuilder.addProperty(name: "date", type: .date, id: 3, uid: 14) try! structEntityBuilder.lastProperty(id: 3, uid: 14) - - modelBuilder.lastEntity(id: 3, uid: 1002) - modelBuilder.lastIndex(id: 0, uid: 0) + + // Copied from actual generated entity info; which is clumsy... + // Probably should clean up and just use generated entity info directly for all entity types. + let entityBuilder = try! modelBuilder.entityBuilder(for: UniqueEntity.self, id: 7, uid: 6258744021471265280) + try! entityBuilder.addProperty(name: "id", type: PropertyType.long, flags: [.id], id: 1, uid: 8418474383607017216) + try! entityBuilder.addProperty(name: "name", type: PropertyType.string, flags: [.unique, .indexHash, .indexed], id: 2, uid: 6588651899515438336, indexId: 3, indexUid: 4943227758701996288) + try! entityBuilder.addProperty(name: "content", type: PropertyType.string, id: 3, uid: 2295067898156422912) + try! entityBuilder.addProperty(name: "content2", type: PropertyType.string, id: 4, uid: 8083811964173041920) + try! entityBuilder.addProperty(name: "str1", type: PropertyType.string, id: 5, uid: 2085921255424893696) + try! entityBuilder.addProperty(name: "str2", type: PropertyType.string, id: 6, uid: 3046539664613253632) + try! entityBuilder.addProperty(name: "str3", type: PropertyType.string, id: 7, uid: 4836319770403460352) + try! entityBuilder.addProperty(name: "str4", type: PropertyType.string, id: 8, uid: 5586670376507097344) + try! entityBuilder.addProperty(name: "str5", type: PropertyType.string, id: 9, uid: 8779305452755862528) + try! entityBuilder.addProperty(name: "str6", type: PropertyType.string, id: 10, uid: 7042629853749457152) + try! entityBuilder.addProperty(name: "str7", type: PropertyType.string, id: 11, uid: 439706265026898176) + try! entityBuilder.addProperty(name: "str8", type: PropertyType.string, id: 12, uid: 7797853325787760640) + try! entityBuilder.addProperty(name: "str9", type: PropertyType.string, id: 13, uid: 6241625149586299904) + try! entityBuilder.addProperty(name: "str10", type: PropertyType.string, id: 14, uid: 3838386263292640000) + try! entityBuilder.addProperty(name: "str11", type: PropertyType.string, id: 15, uid: 2743032249190027008) + try! entityBuilder.addProperty(name: "str12", type: PropertyType.string, id: 16, uid: 6199657977327115264) + try! entityBuilder.addProperty(name: "str13", type: PropertyType.string, id: 17, uid: 6070699861433961728) + try! entityBuilder.addProperty(name: "str14", type: PropertyType.string, id: 18, uid: 6029297771178376192) + try! entityBuilder.addProperty(name: "str15", type: PropertyType.string, id: 19, uid: 3801959474204611328) + try! entityBuilder.addProperty(name: "str16", type: PropertyType.string, id: 20, uid: 4774675437756918784) + try! entityBuilder.addProperty(name: "str17", type: PropertyType.string, id: 21, uid: 8716823039315984640) + try! entityBuilder.addProperty(name: "str18", type: PropertyType.string, id: 22, uid: 8894733078890829312) + try! entityBuilder.addProperty(name: "str19", type: PropertyType.string, id: 23, uid: 1016331229052728320) + try! entityBuilder.addProperty(name: "str20", type: PropertyType.string, id: 24, uid: 7810872262587479552) + try! entityBuilder.addProperty(name: "str21", type: PropertyType.string, id: 25, uid: 4945264553128454912) + try! entityBuilder.addProperty(name: "str22", type: PropertyType.string, id: 26, uid: 7152265273971458560) + try! entityBuilder.addProperty(name: "str23", type: PropertyType.string, id: 27, uid: 6294538152931964672) + try! entityBuilder.addProperty(name: "str24", type: PropertyType.string, id: 28, uid: 1939674925644995328) + try! entityBuilder.addProperty(name: "str25", type: PropertyType.string, id: 29, uid: 2630803146682539264) + try! entityBuilder.addProperty(name: "str26", type: PropertyType.string, id: 30, uid: 2158082104313626880) + try! entityBuilder.addProperty(name: "str27", type: PropertyType.string, id: 31, uid: 4342475978535002368) + try! entityBuilder.addProperty(name: "str28", type: PropertyType.string, id: 32, uid: 2618142912991854080) + try! entityBuilder.addProperty(name: "str29", type: PropertyType.string, id: 33, uid: 4257312550012133632) + try! entityBuilder.addProperty(name: "str30", type: PropertyType.string, id: 34, uid: 6658936396910379008) + try! entityBuilder.addProperty(name: "str31", type: PropertyType.string, id: 35, uid: 7163695098896884992) + try! entityBuilder.addProperty(name: "str32", type: PropertyType.string, id: 36, uid: 7792683921785881088) + try! entityBuilder.addProperty(name: "str33", type: PropertyType.string, id: 37, uid: 2422385911045001728) + try! entityBuilder.addProperty(name: "str34", type: PropertyType.string, id: 38, uid: 672123555343571712) + try! entityBuilder.addProperty(name: "str35", type: PropertyType.string, id: 39, uid: 3356171792266690304) + try! entityBuilder.addProperty(name: "str36", type: PropertyType.string, id: 40, uid: 8097607156277667584) + try! entityBuilder.addProperty(name: "str37", type: PropertyType.string, id: 41, uid: 5877691172915301888) + try! entityBuilder.addProperty(name: "str38", type: PropertyType.string, id: 42, uid: 7464585023102901248) + try! entityBuilder.addProperty(name: "str39", type: PropertyType.string, id: 43, uid: 8211367673094595840) + try! entityBuilder.addProperty(name: "str40", type: PropertyType.string, id: 44, uid: 123610260452597504) + try! entityBuilder.addProperty(name: "str41", type: PropertyType.string, id: 45, uid: 2650611557939850240) + try! entityBuilder.addProperty(name: "str42", type: PropertyType.string, id: 46, uid: 8393105718552925184) + try! entityBuilder.addProperty(name: "str43", type: PropertyType.string, id: 47, uid: 6619994367521497344) + try! entityBuilder.addProperty(name: "str44", type: PropertyType.string, id: 48, uid: 4805478268913715712) + try! entityBuilder.addProperty(name: "str45", type: PropertyType.string, id: 49, uid: 8642866290657149184) + try! entityBuilder.addProperty(name: "str46", type: PropertyType.string, id: 50, uid: 5061363131252470016) + try! entityBuilder.addProperty(name: "str47", type: PropertyType.string, id: 51, uid: 4113947004423223040) + try! entityBuilder.addProperty(name: "str48", type: PropertyType.string, id: 52, uid: 9141471831020050944) + try! entityBuilder.addProperty(name: "str49", type: PropertyType.string, id: 53, uid: 938475961386865664) + try! entityBuilder.addProperty(name: "str50", type: PropertyType.string, id: 54, uid: 2610097445773727232) + try! entityBuilder.addProperty(name: "str51", type: PropertyType.string, id: 55, uid: 8223075157327230976) + try! entityBuilder.addProperty(name: "str52", type: PropertyType.string, id: 56, uid: 6658701894057099520) + try! entityBuilder.addProperty(name: "str53", type: PropertyType.string, id: 57, uid: 4320563155554460672) + try! entityBuilder.addProperty(name: "str54", type: PropertyType.string, id: 58, uid: 3648783095476185088) + try! entityBuilder.addProperty(name: "str55", type: PropertyType.string, id: 59, uid: 7718378802309229824) + try! entityBuilder.addProperty(name: "str56", type: PropertyType.string, id: 60, uid: 7657786762797563392) + try! entityBuilder.addProperty(name: "str57", type: PropertyType.string, id: 61, uid: 729766303749804544) + try! entityBuilder.addProperty(name: "str58", type: PropertyType.string, id: 62, uid: 8250473843241116672) + try! entityBuilder.addProperty(name: "str59", type: PropertyType.string, id: 63, uid: 4473980843763389184) + try! entityBuilder.lastProperty(id: 63, uid: 4473980843763389184) + + modelBuilder.lastEntity(id: 7, uid: 6258744021471265280) + modelBuilder.lastIndex(id: 3, uid: 4943227758701996288) return modelBuilder.finish() } @@ -166,11 +234,11 @@ public func createTestModel(syncEnabled: Bool = false) -> OpaquePointer { extension TestPerson: Entity, EntityInspectable, __EntityRelatable { public typealias EntityBindingType = TestPersonCursor - + public static var entityBinding = EntityBindingType() - + public static var entityInfo = EntityInfo(name: "TestPerson", id: 2) - + public var _id: EntityId { return self.id } public static var age: Property { @@ -184,11 +252,11 @@ extension TestPerson: Entity, EntityInspectable, __EntityRelatable { extension AllTypesEntity: Entity, EntityInspectable, __EntityRelatable { public typealias EntityType = AllTypesEntity - + public typealias EntityBindingType = AllTypesEntityCursor - + public static var entityBinding = EntityBindingType() - + public static var entityInfo = EntityInfo(name: "AllTypesEntity", id: 1) public var _id: EntityId { return self.id } @@ -196,7 +264,7 @@ extension AllTypesEntity: Entity, EntityInspectable, __EntityRelatable { public static var boolean: Property { return Property(propertyId: 2, isPrimaryKey: false) } - + public static var long: Property { return Property(propertyId: 3, isPrimaryKey: false) } @@ -204,19 +272,19 @@ extension AllTypesEntity: Entity, EntityInspectable, __EntityRelatable { public static var integer: Property { return Property(propertyId: 4, isPrimaryKey: false) } - + public static var unsigned: Property { return Property(propertyId: 5, isPrimaryKey: false) } - + public static var double: Property { return Property(propertyId: 6, isPrimaryKey: false) } - + public static var string: Property { return Property(propertyId: 8, isPrimaryKey: false) } - + public static var date: Property { return Property(propertyId: 7, isPrimaryKey: false) } @@ -233,11 +301,11 @@ public class TestPersonCursor: EntityBinding { public func setEntityIdUnlessStruct(of entity: TestPerson, to entityId: Id) { entity.id = EntityId(entityId) } - + public func entityId(of entity: TestPerson) -> Id { return entity.id.value } - + public func collect(fromEntity entity: TestPerson, id: Id, propertyCollector: FlatBufferBuilder, store: Store) { let nameOffset = propertyCollector.prepare(string: entity.name) @@ -245,7 +313,7 @@ public class TestPersonCursor: EntityBinding { propertyCollector.collect(entity.age, at: 6) propertyCollector.collect(dataOffset: nameOffset, at: 8) } - + public func createEntity(entityReader: FlatBufferReader, store: Store) -> TestPerson { let result = TestPerson() result.id = EntityId(entityReader.read(at: 4)) @@ -267,15 +335,15 @@ public class AllTypesEntityCursor: EntityBinding { public func setEntityIdUnlessStruct(of entity: AllTypesEntity, to entityId: Id) { entity.id = EntityId(entityId) } - + public func entityId(of entity: AllTypesEntity) -> Id { return entity.id.value } - + public func collect(fromEntity entity: AllTypesEntity, id: Id, propertyCollector: FlatBufferBuilder, store: Store) { let offset = propertyCollector.prepare(string: entity.string) - + propertyCollector.collect(id, at: AllTypesOffset.ID.rawValue) propertyCollector.collect(entity.boolean, at: AllTypesOffset.bool.rawValue) propertyCollector.collect(entity.aLong, at: AllTypesOffset.long.rawValue) @@ -286,10 +354,10 @@ public class AllTypesEntityCursor: EntityBinding { propertyCollector.collect(dataOffset: offset, at: AllTypesOffset.string.rawValue) } - + public func createEntity(entityReader: FlatBufferReader, store: Store) -> AllTypesEntity { let result = AllTypesEntity() - + result.id = EntityId(entityReader.read(at: AllTypesOffset.ID.rawValue)) result.boolean = entityReader.read(at: AllTypesOffset.bool.rawValue) result.aLong = entityReader.read(at: AllTypesOffset.long.rawValue) @@ -298,7 +366,7 @@ public class AllTypesEntityCursor: EntityBinding { result.aDouble = entityReader.read(at: AllTypesOffset.double.rawValue) result.date = entityReader.read(at: AllTypesOffset.date.rawValue) result.string = entityReader.read(at: AllTypesOffset.string.rawValue) - + return result } } diff --git a/Source/ios-framework/CommonTests/StoreTests.swift b/Source/ios-framework/CommonTests/StoreTests.swift index 8b27eb7..5b3af2d 100644 --- a/Source/ios-framework/CommonTests/StoreTests.swift +++ b/Source/ios-framework/CommonTests/StoreTests.swift @@ -48,9 +48,19 @@ class StoreTests: XCTestCase { // Update the expected versions every now and then. // TODO XCTAssertGreaterThanOrEqual doesn't respect semantic versioning: // e.g. 0.10.0 will be evaluated as lower than 0.9.1 - XCTAssertGreaterThanOrEqual(Store.version, "1.8.0") + XCTAssertGreaterThanOrEqual(Store.version, "1.8.1") XCTAssertGreaterThanOrEqual(Store.versionLib, "0.18.0") - XCTAssertGreaterThanOrEqual(Store.versionCore, "3.5.0-2022-12-05") + XCTAssertGreaterThanOrEqual(Store.versionCore, "3.5.1-2023-01-26") + } + + func testCloseTwice() { + store.close() + store.close() + } + + func testCloseAndDeleteAllFilesTwice() throws { + try store.closeAndDeleteAllFiles() + try store.closeAndDeleteAllFiles() } func test32vs64BitForOs() { diff --git a/Source/ios-framework/CommonTests/SyncTests.swift b/Source/ios-framework/CommonTests/SyncTests.swift new file mode 100644 index 0000000..1dc36a2 --- /dev/null +++ b/Source/ios-framework/CommonTests/SyncTests.swift @@ -0,0 +1,206 @@ +// +// Copyright (c) 2020 ObjectBox. All rights reserved. +// + +import Foundation +import XCTest +@testable import ObjectBox + +enum TestError: Error { + case loginError(String) +} + +class SyncTests: XCTestCase { + + class CountingListener: SyncListener { + var loggedInCount = 0 + var loginFailedCount = 0 + var updatesCompletedCount = 0 + var connectedCount = 0 + var disconnectedCount = 0 + var changesCount = 0 + + func loggedIn() { + loggedInCount += 1 + } + + func loginFailed(result: SyncCode) { + loginFailedCount += 1 + } + + func updatesCompleted() { + updatesCompletedCount += 1 + } + + func connected() { + connectedCount += 1 + } + + func disconnected() { + disconnectedCount += 1 + } + + } + + var store: Store! + + override func setUpWithError() throws { + super.setUp() + store = StoreHelper.tempStore(model: createTestModel()) + } + + private func createClient(_ store: Store) throws -> SyncClient { + try Sync.makeClient(store: store, urlString: "ws://127.0.0.1:9999") + } + + + private func loginNewClient(_ store: Store, listener: CountingListener? = nil, + updateRequestMode: RequestUpdatesMode = .auto) throws -> SyncClient { + let client = try createClient(store) + try client.setCredentials(SyncCredentials.makeNone()) + client.listener = listener + client.updateRequestMode = updateRequestMode + try client.start() + let result = try client.waitForLoggedInState(timeoutMilliseconds: 1000) + if result == .success { + print("A client logged in") + } else if result == .timeout { + // We still proceed to detect no server is running + // throw TestError.loginError("Timeout") + print("A client failed to log in (timeout)") + } else { + // We still proceed to detect no server is running + //throw TestError.loginError("Failure") + print("A client failed to log in (failed)") + } + return client + } + + func waitForMinValue(value: inout Int, target: Int, seconds: Int = 3) -> Bool { + for _ in 0...1000 * seconds { // 1 sec or until we logged in + usleep(1000) // 1 ms + if value >= target { + return true + } + } + return false + } + + private func waitForCount(_ box: Box, _ count: Int) throws { + for _ in 1...20 { // Max total time is 2s: 20 * 100 ms + if try box.count() == count { + break + } + usleep(100000) + } + } + + func testSyncClientConnect() throws { + let listener = CountingListener() + let client = try loginNewClient(store, listener: listener) + guard listener.loggedInCount == 1 else { + print("Could not login, skipping further testing") + if #available(OSX 10.12, *) { + let serverExe = try findServerExe() + if serverExe != nil { + print("Try running this command:") + print(serverExe!, " --unsecured-no-authentication", "--bind ws://0.0.0.0:9999", + "--browser-bind 0.0.0.0:9980", "--model", + "ios-framework/CommonTests/Helpers/test-model.json") + } + } + return + } + XCTAssertGreaterThan(listener.connectedCount, 0) + + XCTAssert(waitForMinValue(value: &listener.updatesCompletedCount, target: 1)) + let updatesCompletedCountInitial: Int = listener.updatesCompletedCount + + let object = AllTypesEntity.create(string: "hello dear") + object.date = Date() + let box = store.box(for: AllTypesEntity.self) + let id1 = try box.put(object).value + let count1 = try box.count() + print("Objects in box1 after sync completion:", count1) + + let store2 = StoreHelper.tempStore(model: createTestModel()) + let listener2 = CountingListener() + let client2 = try loginNewClient(store2, listener: listener2) + XCTAssert(waitForMinValue(value: &listener2.updatesCompletedCount, target: 1)) + let box2 = store2.box(for: AllTypesEntity.self) + try waitForCount(box2, count1) + XCTAssertEqual(count1, try box2.count()) + + let objectFromClient1 = try box2.get(id: id1) + XCTAssertNotNil(objectFromClient1) + XCTAssertEqual(object.date!.unixTimestamp, objectFromClient1!.date!.unixTimestamp) // unixTimestamp to avoid FP + XCTAssertEqual(object.string!, objectFromClient1!.string!) + + let object2 = AllTypesEntity.create(string: "oh my") + object2.date = Date() + let id2 = try box2.put(object2).value + XCTAssertNotEqual(id1, id2) + + // NewDataPusher is not yet sending MSG_APPLY_TX_FLAGS_HISTORY_UPTODATE -> completed listener not fired: + // XCTAssert(waitForMinValue(value: &listener.updatesCompletedCount, target: updatesCompletedCountInitial + 1)) + try waitForCount(box, count1 + 1) + XCTAssertEqual(try box.count(), count1 + 1) + let objectFromClient2 = try box.get(id: id2) + XCTAssertEqual(object2.date!.unixTimestamp, objectFromClient2!.date!.unixTimestamp) + XCTAssertEqual(object2.string!, objectFromClient2!.string!) + + // No RAII in Swift; use clients again to also silence "Initialization ... was never used"; + // also withExtendedLifetime() is awkward + try client.stop() + try client2.stop() + } + + func testSyncClientHeartbeat() throws { + let client = try loginNewClient(store, updateRequestMode: .manual) + guard client.getState() == .loggedIn else { + print("Could not login, skipping further testing") + return + } + // To be checked manually at server with debug logging enabled + try client.sendHeartbeat() + try client.sendHeartbeat() + try client.sendHeartbeat() + try client.setHeartbeatInterval(milliseconds: 1000) + for _ in 1...10 { + sleep(1) + print("State:", client.getState()) + } + } + + + // Maybe we could start the server automatically... + @available(macOS 10.12, *) + func findServerExe() throws -> String? { + #if os(macOS) + let home = FileManager.default.homeDirectoryForCurrentUser.path + let baseDir = home + "/dev/objectbox/" + let buildDirs = ["cmake-build-debug", "cmake-build-release", "cbuild/Debug", "cbuild/Release"] + let relPathToExe = "/objectbox/src/main/cpp/sync/server/sync-server" + var newestDate: Date? + var chosenPath: String? + + for buildDir in buildDirs { + let path = baseDir + buildDir + relPathToExe + if FileManager.default.isExecutableFile(atPath: path) { + let attrs = try FileManager.default.attributesOfItem(atPath: path) + let date = attrs[FileAttributeKey.modificationDate] as? Date + let size = attrs[FileAttributeKey.size] + print("A sync server was found: ", date ?? "?", path, ", size:", size ?? 0) + if newestDate == nil || (date != nil && date!.unixTimestamp > newestDate!.unixTimestamp) { + newestDate = date + chosenPath = path + } + } + } + return chosenPath + #else + return nil + #endif + } + +} diff --git a/Source/ios-framework/CommonTests/Test Entities/Entities.swift b/Source/ios-framework/CommonTests/Test Entities/Entities.swift new file mode 100644 index 0000000..33c042e --- /dev/null +++ b/Source/ios-framework/CommonTests/Test Entities/Entities.swift @@ -0,0 +1,206 @@ +// +// Copyright © 2019-2023 ObjectBox. All rights reserved. +// + +// Note: Use the script generate.rb to manually update EntityInfo.generated.swift +// TODO/Warning: This seems not to be used in our standard unit tests. Might make sense; check TestEntities too. + +import Foundation +import ObjectBox + +class Note: Entity { + var id: Id = 0 + var title: String = "" { + didSet { + modificationDate = Date() + } + } + var text: String = "" { + didSet { + modificationDate = Date() + } + } + var creationDate: Date? = Date() + var modificationDate: Date? + var author: ToOne = nil + var done: Bool = false + var upvotes: UInt32 = 0 + + // An initializer with no parameters is required by ObjectBox + required init() { + // Nothing to do since we initialize the properties upon declaration here. + // See `Author` for a different approach + } + + convenience init(title: String, text: String) { + self.init() + self.title = title + self.text = text + } +} + +// objectbox:Entity +struct NoteStruct { + var id: Id = 0 + var title: String = "" { + didSet { + modificationDate = Date() + } + } + var text: String = "" { + didSet { + modificationDate = Date() + } + } + var creationDate: Date? = Date() + var modificationDate: Date? + var author: ToOne = nil +} + +// objectbox:Entity +class Author { + var id: EntityId = 0 + var name: String + + var notesStandalone: ToMany + + // objectbox: backlink = "author" + var notes: ToMany + var yearOfBirth: UInt16? + + + // An initializer with no parameters is required by ObjectBox + required init() { + self.id = 0 + self.name = "" + self.notes = nil + self.notesStandalone = nil + } + + convenience init(name: String) { + self.init() + self.name = name + } +} + +// objectbox:Entity +struct AuthorStruct { + var id: EntityId = 0 + var name: String + var notes: ToMany +} + +// objectbox:Entity +class Teacher { + var id: Id = 0 + var name: String + + // objectbox:backlink = "teachers" + var students: ToMany = nil + + required init() { + self.id = 0 + self.name = "" + } + + convenience init(name: String) { + self.init() + self.name = name + } +} + +// objectbox:Entity +class Student { + var id: Id = 0 + var name: String + + var teachers: ToMany = nil + + required init() { + self.id = 0 + self.name = "" + } + + convenience init(name: String) { + self.init() + self.name = name + } +} + +// objectbox:Entity +class UniqueEntity { + var id: Id = 0 + // objectbox:unique + var name: String = "" + var content: String = "" + var content2: String = "" + var str1: String = "" + var str2: String = "" + var str3: String = "" + var str4: String = "" + var str5: String = "" + var str6: String = "" + var str7: String = "" + var str8: String = "" + var str9: String = "" + var str10: String = "" + var str11: String = "" + var str12: String = "" + var str13: String = "" + var str14: String = "" + var str15: String = "" + var str16: String = "" + var str17: String = "" + var str18: String = "" + var str19: String = "" + var str20: String = "" + var str21: String = "" + var str22: String = "" + var str23: String = "" + var str24: String = "" + var str25: String = "" + var str26: String = "" + var str27: String = "" + var str28: String = "" + var str29: String = "" + var str30: String = "" + var str31: String = "" + var str32: String = "" + var str33: String = "" + var str34: String = "" + var str35: String = "" + var str36: String = "" + var str37: String = "" + var str38: String = "" + var str39: String = "" + var str40: String = "" + var str41: String = "" + var str42: String = "" + var str43: String = "" + var str44: String = "" + var str45: String = "" + var str46: String = "" + var str47: String = "" + var str48: String = "" + var str49: String = "" + var str50: String = "" + var str51: String = "" + var str52: String = "" + var str53: String = "" + var str54: String = "" + var str55: String = "" + var str56: String = "" + var str57: String = "" + var str58: String = "" + var str59: String = "" + + required init() { + } + + convenience init(name: String, content: String = "", content2: String = "") { + self.init() + self.name = name + self.content = content + self.content2 = content2 + } +} diff --git a/Source/ios-framework/CommonTests/Test Entities/EntityInfo.generated.swift b/Source/ios-framework/CommonTests/Test Entities/EntityInfo.generated.swift new file mode 100644 index 0000000..85b903b --- /dev/null +++ b/Source/ios-framework/CommonTests/Test Entities/EntityInfo.generated.swift @@ -0,0 +1,2286 @@ +// Generated using the ObjectBox Swift Generator — https://objectbox.io +// DO NOT EDIT +// swiftlint:disable all +import ObjectBox +import Foundation + +// MARK: - Entity metadata + +extension Author: ObjectBox.Entity {} +extension AuthorStruct: ObjectBox.Entity {} +extension NoteStruct: ObjectBox.Entity {} +extension Student: ObjectBox.Entity {} +extension Teacher: ObjectBox.Entity {} +extension UniqueEntity: ObjectBox.Entity {} + +extension Author: ObjectBox.__EntityRelatable { + internal typealias EntityType = Author + + internal var _id: EntityId { + return EntityId(self.id.value) + } +} + +extension Author: ObjectBox.EntityInspectable { + internal typealias EntityBindingType = AuthorBinding + + /// Generated metadata used by ObjectBox to persist the entity. + internal static var entityInfo = ObjectBox.EntityInfo(name: "Author", id: 1) + + internal static var entityBinding = EntityBindingType() + + fileprivate static func buildEntity(modelBuilder: ObjectBox.ModelBuilder) throws { + let entityBuilder = try modelBuilder.entityBuilder(for: Author.self, id: 1, uid: 3576167000524145664) + try entityBuilder.addProperty(name: "id", type: PropertyType.long, flags: [.id], id: 1, uid: 4782546707843525376) + try entityBuilder.addProperty(name: "name", type: PropertyType.string, id: 2, uid: 8205028904652262144) + try entityBuilder.addProperty(name: "yearOfBirth", type: PropertyType.short, id: 3, uid: 6604692165263705088) + try entityBuilder.addToManyRelation(id: 1, uid: 6166183021412625664, + targetId: 3, targetUid: 8286413937822989568) + + try entityBuilder.lastProperty(id: 3, uid: 6604692165263705088) + } +} + +extension Author { + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { Author.id == myId } + internal static var id: Property, EntityId> { return Property, EntityId>(propertyId: 1, isPrimaryKey: true) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { Author.name.startsWith("X") } + internal static var name: Property { return Property(propertyId: 2, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { Author.yearOfBirth > 1234 } + internal static var yearOfBirth: Property { return Property(propertyId: 3, isPrimaryKey: false) } + /// Use `Author.notesStandalone` to refer to this ToMany relation property in queries, + /// like when using `QueryBuilder.and(property:, conditions:)`. + + internal static var notesStandalone: ToManyProperty { return ToManyProperty(.relationId(1)) } + + /// Use `Author.notes` to refer to this ToMany relation property in queries, + /// like when using `QueryBuilder.and(property:, conditions:)`. + + internal static var notes: ToManyProperty { return ToManyProperty(.valuePropertyId(6)) } + + + fileprivate func __setId(identifier: ObjectBox.Id) { + self.id = EntityId(identifier) + } +} + +extension ObjectBox.Property where E == Author { + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .id == myId } + + internal static var id: Property, EntityId> { return Property, EntityId>(propertyId: 1, isPrimaryKey: true) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .name.startsWith("X") } + + internal static var name: Property { return Property(propertyId: 2, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .yearOfBirth > 1234 } + + internal static var yearOfBirth: Property { return Property(propertyId: 3, isPrimaryKey: false) } + + /// Use `.notesStandalone` to refer to this ToMany relation property in queries, like when using + /// `QueryBuilder.and(property:, conditions:)`. + + internal static var notesStandalone: ToManyProperty { return ToManyProperty(.relationId(1)) } + + /// Use `.notes` to refer to this ToMany relation property in queries, like when using + /// `QueryBuilder.and(property:, conditions:)`. + + internal static var notes: ToManyProperty { return ToManyProperty(.valuePropertyId(6)) } + +} + + +/// Generated service type to handle persisting and reading entity data. Exposed through `Author.EntityBindingType`. +internal class AuthorBinding: ObjectBox.EntityBinding { + internal typealias EntityType = Author + internal typealias IdType = EntityId + + internal required init() {} + + internal func generatorBindingVersion() -> Int { 1 } + + internal func setEntityIdUnlessStruct(of entity: EntityType, to entityId: ObjectBox.Id) { + entity.__setId(identifier: entityId) + } + + internal func entityId(of entity: EntityType) -> ObjectBox.Id { + return entity.id.value + } + + internal func collect(fromEntity entity: EntityType, id: ObjectBox.Id, + propertyCollector: ObjectBox.FlatBufferBuilder, store: ObjectBox.Store) throws { + let propertyOffset_name = propertyCollector.prepare(string: entity.name) + + propertyCollector.collect(id, at: 2 + 2 * 1) + propertyCollector.collect(entity.yearOfBirth, at: 2 + 2 * 3) + propertyCollector.collect(dataOffset: propertyOffset_name, at: 2 + 2 * 2) + } + + internal func postPut(fromEntity entity: EntityType, id: ObjectBox.Id, store: ObjectBox.Store) throws { + if entityId(of: entity) == 0 { // New object was put? Attach relations now that we have an ID. + let notesStandalone = ToMany.relation( + sourceId: EntityId(id.value), + targetBox: store.box(for: ToMany.ReferencedType.self), + relationId: 1) + if !entity.notesStandalone.isEmpty { + notesStandalone.replace(entity.notesStandalone) + } + entity.notesStandalone = notesStandalone + let notes = ToMany.backlink( + sourceBox: store.box(for: ToMany.ReferencedType.self), + sourceProperty: ToMany.ReferencedType.author, + targetId: EntityId(id.value)) + if !entity.notes.isEmpty { + notes.replace(entity.notes) + } + entity.notes = notes + try entity.notesStandalone.applyToDb() + try entity.notes.applyToDb() + } + } + internal func createEntity(entityReader: ObjectBox.FlatBufferReader, store: ObjectBox.Store) -> EntityType { + let entity = Author() + + entity.id = entityReader.read(at: 2 + 2 * 1) + entity.name = entityReader.read(at: 2 + 2 * 2) + entity.yearOfBirth = entityReader.read(at: 2 + 2 * 3) + + entity.notesStandalone = ToMany.relation( + sourceId: EntityId(entity.id.value), + targetBox: store.box(for: ToMany.ReferencedType.self), + relationId: 1) + entity.notes = ToMany.backlink( + sourceBox: store.box(for: ToMany.ReferencedType.self), + sourceProperty: ToMany.ReferencedType.author, + targetId: EntityId(entity.id.value)) + return entity + } +} + + + +extension AuthorStruct: ObjectBox.__EntityRelatable { + internal typealias EntityType = AuthorStruct + + internal var _id: EntityId { + return EntityId(self.id.value) + } +} + +extension AuthorStruct: ObjectBox.EntityInspectable { + internal typealias EntityBindingType = AuthorStructBinding + + /// Generated metadata used by ObjectBox to persist the entity. + internal static var entityInfo = ObjectBox.EntityInfo(name: "AuthorStruct", id: 2) + + internal static var entityBinding = EntityBindingType() + + fileprivate static func buildEntity(modelBuilder: ObjectBox.ModelBuilder) throws { + let entityBuilder = try modelBuilder.entityBuilder(for: AuthorStruct.self, id: 2, uid: 1229901451922443520) + try entityBuilder.addProperty(name: "id", type: PropertyType.long, flags: [.id], id: 1, uid: 3324125320646150656) + try entityBuilder.addProperty(name: "name", type: PropertyType.string, id: 2, uid: 2629753880188920064) + try entityBuilder.addToManyRelation(id: 2, uid: 7420642801495878912, + targetId: 4, targetUid: 1267197271366405632) + + try entityBuilder.lastProperty(id: 2, uid: 2629753880188920064) + } +} + +extension AuthorStruct { + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { AuthorStruct.id == myId } + internal static var id: Property, EntityId> { return Property, EntityId>(propertyId: 1, isPrimaryKey: true) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { AuthorStruct.name.startsWith("X") } + internal static var name: Property { return Property(propertyId: 2, isPrimaryKey: false) } + /// Use `AuthorStruct.notes` to refer to this ToMany relation property in queries, + /// like when using `QueryBuilder.and(property:, conditions:)`. + + internal static var notes: ToManyProperty { return ToManyProperty(.relationId(2)) } + + + fileprivate mutating func __setId(identifier: ObjectBox.Id) { + self.id = EntityId(identifier) + } +} + +extension ObjectBox.Property where E == AuthorStruct { + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .id == myId } + + internal static var id: Property, EntityId> { return Property, EntityId>(propertyId: 1, isPrimaryKey: true) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .name.startsWith("X") } + + internal static var name: Property { return Property(propertyId: 2, isPrimaryKey: false) } + + /// Use `.notes` to refer to this ToMany relation property in queries, like when using + /// `QueryBuilder.and(property:, conditions:)`. + + internal static var notes: ToManyProperty { return ToManyProperty(.relationId(2)) } + +} + + +/// Generated service type to handle persisting and reading entity data. Exposed through `AuthorStruct.EntityBindingType`. +internal class AuthorStructBinding: ObjectBox.EntityBinding { + internal typealias EntityType = AuthorStruct + internal typealias IdType = EntityId + + internal required init() {} + + internal func generatorBindingVersion() -> Int { 1 } + + internal func setStructEntityId(of entity: inout EntityType, to entityId: ObjectBox.Id) { + entity.__setId(identifier: entityId) + } + + internal func entityId(of entity: EntityType) -> ObjectBox.Id { + return entity.id.value + } + + internal func collect(fromEntity entity: EntityType, id: ObjectBox.Id, + propertyCollector: ObjectBox.FlatBufferBuilder, store: ObjectBox.Store) throws { + let propertyOffset_name = propertyCollector.prepare(string: entity.name) + + propertyCollector.collect(id, at: 2 + 2 * 1) + propertyCollector.collect(dataOffset: propertyOffset_name, at: 2 + 2 * 2) + } + + internal func createEntity(entityReader: ObjectBox.FlatBufferReader, store: ObjectBox.Store) -> EntityType { + let entityId: EntityId = entityReader.read(at: 2 + 2 * 1) + let entity = AuthorStruct( + id: entityId, + name: entityReader.read(at: 2 + 2 * 2), + notes: ToMany.relation( + sourceId: EntityId(entityId.value), + targetBox: store.box(for: ToMany.ReferencedType.self), + relationId: 2) + ) + return entity + } +} + +extension ObjectBox.Box where E == AuthorStruct { + + /// Puts the AuthorStruct in the box (aka persisting it) returning a copy with the ID updated to the ID it + /// has been assigned. + /// If you know the entity has already been persisted, you can use put() to avoid the cost of the copy. + /// + /// - Parameter entity: Object to persist. + /// - Returns: The stored object. If `entity`'s id is 0, an ID is generated. + /// - Throws: ObjectBoxError errors for database write errors. + func put(struct entity: AuthorStruct) throws -> AuthorStruct { + let entityId: AuthorStruct.EntityBindingType.IdType = try self.put(entity) + + return AuthorStruct( + id: entityId, + name: entity.name, + notes: entity.notes + ) + } + + /// Puts the AuthorStructs in the box (aka persisting it) returning copies with their IDs updated to the + /// IDs they've been assigned. + /// If you know all entities have already been persisted, you can use put() to avoid the cost of the + /// copies. + /// + /// - Parameter entities: Objects to persist. + /// - Returns: The stored objects. If any entity's id is 0, an ID is generated. + /// - Throws: ObjectBoxError errors for database write errors. + func put(structs entities: [AuthorStruct]) throws -> [AuthorStruct] { + let entityIds: [AuthorStruct.EntityBindingType.IdType] = try self.putAndReturnIDs(entities) + var newEntities = [AuthorStruct]() + newEntities.reserveCapacity(entities.count) + + for i in 0 ..< min(entities.count, entityIds.count) { + let entity = entities[i] + let entityId = entityIds[i] + + newEntities.append(AuthorStruct( + id: entityId, + name: entity.name, + notes: entity.notes + )) + } + + return newEntities + } +} + + +extension Note: ObjectBox.__EntityRelatable { + internal typealias EntityType = Note + + internal var _id: EntityId { + return EntityId(self.id.value) + } +} + +extension Note: ObjectBox.EntityInspectable { + internal typealias EntityBindingType = NoteBinding + + /// Generated metadata used by ObjectBox to persist the entity. + internal static var entityInfo = ObjectBox.EntityInfo(name: "Note", id: 3) + + internal static var entityBinding = EntityBindingType() + + fileprivate static func buildEntity(modelBuilder: ObjectBox.ModelBuilder) throws { + let entityBuilder = try modelBuilder.entityBuilder(for: Note.self, id: 3, uid: 8286413937822989568) + try entityBuilder.addProperty(name: "id", type: PropertyType.long, flags: [.id], id: 1, uid: 8202191337322996480) + try entityBuilder.addProperty(name: "title", type: PropertyType.string, id: 2, uid: 1350315346983447296) + try entityBuilder.addProperty(name: "text", type: PropertyType.string, id: 3, uid: 2156716490547525120) + try entityBuilder.addProperty(name: "creationDate", type: PropertyType.date, id: 4, uid: 2259363133844796672) + try entityBuilder.addProperty(name: "modificationDate", type: PropertyType.date, id: 5, uid: 6233774800911586048) + try entityBuilder.addProperty(name: "done", type: PropertyType.bool, id: 7, uid: 3390351202128481792) + try entityBuilder.addProperty(name: "upvotes", type: PropertyType.int, flags: [.unsigned], id: 8, uid: 5856576790296241408) + try entityBuilder.addToOneRelation(name: "author", targetEntityInfo: ToOne.Target.entityInfo, id: 6, uid: 6448513910062322432, indexId: 1, indexUid: 1458654215934992896) + + try entityBuilder.lastProperty(id: 8, uid: 5856576790296241408) + } +} + +extension Note { + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { Note.id == myId } + internal static var id: Property { return Property(propertyId: 1, isPrimaryKey: true) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { Note.title.startsWith("X") } + internal static var title: Property { return Property(propertyId: 2, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { Note.text.startsWith("X") } + internal static var text: Property { return Property(propertyId: 3, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { Note.creationDate > 1234 } + internal static var creationDate: Property { return Property(propertyId: 4, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { Note.modificationDate > 1234 } + internal static var modificationDate: Property { return Property(propertyId: 5, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { Note.done == true } + internal static var done: Property { return Property(propertyId: 7, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { Note.upvotes > 1234 } + internal static var upvotes: Property { return Property(propertyId: 8, isPrimaryKey: false) } + internal static var author: Property.Target>, ToOne.Target> { return Property(propertyId: 6) } + + + fileprivate func __setId(identifier: ObjectBox.Id) { + self.id = Id(identifier) + } +} + +extension ObjectBox.Property where E == Note { + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .id == myId } + + internal static var id: Property { return Property(propertyId: 1, isPrimaryKey: true) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .title.startsWith("X") } + + internal static var title: Property { return Property(propertyId: 2, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .text.startsWith("X") } + + internal static var text: Property { return Property(propertyId: 3, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .creationDate > 1234 } + + internal static var creationDate: Property { return Property(propertyId: 4, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .modificationDate > 1234 } + + internal static var modificationDate: Property { return Property(propertyId: 5, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .done == true } + + internal static var done: Property { return Property(propertyId: 7, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .upvotes > 1234 } + + internal static var upvotes: Property { return Property(propertyId: 8, isPrimaryKey: false) } + + internal static var author: Property.Target.EntityBindingType.IdType, ToOne.Target> { return Property.Target.EntityBindingType.IdType, ToOne.Target>(propertyId: 6) } + +} + + +/// Generated service type to handle persisting and reading entity data. Exposed through `Note.EntityBindingType`. +internal class NoteBinding: ObjectBox.EntityBinding { + internal typealias EntityType = Note + internal typealias IdType = Id + + internal required init() {} + + internal func generatorBindingVersion() -> Int { 1 } + + internal func setEntityIdUnlessStruct(of entity: EntityType, to entityId: ObjectBox.Id) { + entity.__setId(identifier: entityId) + } + + internal func entityId(of entity: EntityType) -> ObjectBox.Id { + return entity.id.value + } + + internal func collect(fromEntity entity: EntityType, id: ObjectBox.Id, + propertyCollector: ObjectBox.FlatBufferBuilder, store: ObjectBox.Store) throws { + let propertyOffset_title = propertyCollector.prepare(string: entity.title) + let propertyOffset_text = propertyCollector.prepare(string: entity.text) + + propertyCollector.collect(id, at: 2 + 2 * 1) + propertyCollector.collect(entity.creationDate, at: 2 + 2 * 4) + propertyCollector.collect(entity.modificationDate, at: 2 + 2 * 5) + propertyCollector.collect(entity.done, at: 2 + 2 * 7) + propertyCollector.collect(entity.upvotes, at: 2 + 2 * 8) + try propertyCollector.collect(entity.author, at: 2 + 2 * 6, store: store) + propertyCollector.collect(dataOffset: propertyOffset_title, at: 2 + 2 * 2) + propertyCollector.collect(dataOffset: propertyOffset_text, at: 2 + 2 * 3) + } + + internal func postPut(fromEntity entity: EntityType, id: ObjectBox.Id, store: ObjectBox.Store) throws { + if entityId(of: entity) == 0 { // New object was put? Attach relations now that we have an ID. + entity.author.attach(to: store.box(for: Author.self)) + } + } + internal func setToOneRelation(_ propertyId: obx_schema_id, of entity: EntityType, to entityId: ObjectBox.Id?) { + switch propertyId { + case 6: + entity.author.targetId = (entityId != nil) ? EntityId(entityId!) : nil + default: + fatalError("Attempt to change nonexistent ToOne relation with ID \(propertyId)") + } + } + internal func createEntity(entityReader: ObjectBox.FlatBufferReader, store: ObjectBox.Store) -> EntityType { + let entity = Note() + + entity.id = entityReader.read(at: 2 + 2 * 1) + entity.title = entityReader.read(at: 2 + 2 * 2) + entity.text = entityReader.read(at: 2 + 2 * 3) + entity.creationDate = entityReader.read(at: 2 + 2 * 4) + entity.modificationDate = entityReader.read(at: 2 + 2 * 5) + entity.done = entityReader.read(at: 2 + 2 * 7) + entity.upvotes = entityReader.read(at: 2 + 2 * 8) + + entity.author = entityReader.read(at: 2 + 2 * 6, store: store) + return entity + } +} + + + +extension NoteStruct: ObjectBox.__EntityRelatable { + internal typealias EntityType = NoteStruct + + internal var _id: EntityId { + return EntityId(self.id.value) + } +} + +extension NoteStruct: ObjectBox.EntityInspectable { + internal typealias EntityBindingType = NoteStructBinding + + /// Generated metadata used by ObjectBox to persist the entity. + internal static var entityInfo = ObjectBox.EntityInfo(name: "NoteStruct", id: 4) + + internal static var entityBinding = EntityBindingType() + + fileprivate static func buildEntity(modelBuilder: ObjectBox.ModelBuilder) throws { + let entityBuilder = try modelBuilder.entityBuilder(for: NoteStruct.self, id: 4, uid: 1267197271366405632) + try entityBuilder.addProperty(name: "id", type: PropertyType.long, flags: [.id], id: 1, uid: 2519416082326737408) + try entityBuilder.addProperty(name: "title", type: PropertyType.string, id: 2, uid: 551839225092133376) + try entityBuilder.addProperty(name: "text", type: PropertyType.string, id: 3, uid: 7011109989572489472) + try entityBuilder.addProperty(name: "creationDate", type: PropertyType.date, id: 4, uid: 778896539487013376) + try entityBuilder.addProperty(name: "modificationDate", type: PropertyType.date, id: 5, uid: 7303324335582009600) + try entityBuilder.addToOneRelation(name: "author", targetEntityInfo: ToOne.Target.entityInfo, id: 6, uid: 2469372667932281088, indexId: 2, indexUid: 6342353045634752256) + + try entityBuilder.lastProperty(id: 6, uid: 2469372667932281088) + } +} + +extension NoteStruct { + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { NoteStruct.id == myId } + internal static var id: Property { return Property(propertyId: 1, isPrimaryKey: true) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { NoteStruct.title.startsWith("X") } + internal static var title: Property { return Property(propertyId: 2, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { NoteStruct.text.startsWith("X") } + internal static var text: Property { return Property(propertyId: 3, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { NoteStruct.creationDate > 1234 } + internal static var creationDate: Property { return Property(propertyId: 4, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { NoteStruct.modificationDate > 1234 } + internal static var modificationDate: Property { return Property(propertyId: 5, isPrimaryKey: false) } + internal static var author: Property.Target>, ToOne.Target> { return Property(propertyId: 6) } + + + fileprivate mutating func __setId(identifier: ObjectBox.Id) { + self.id = Id(identifier) + } +} + +extension ObjectBox.Property where E == NoteStruct { + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .id == myId } + + internal static var id: Property { return Property(propertyId: 1, isPrimaryKey: true) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .title.startsWith("X") } + + internal static var title: Property { return Property(propertyId: 2, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .text.startsWith("X") } + + internal static var text: Property { return Property(propertyId: 3, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .creationDate > 1234 } + + internal static var creationDate: Property { return Property(propertyId: 4, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .modificationDate > 1234 } + + internal static var modificationDate: Property { return Property(propertyId: 5, isPrimaryKey: false) } + + internal static var author: Property.Target.EntityBindingType.IdType, ToOne.Target> { return Property.Target.EntityBindingType.IdType, ToOne.Target>(propertyId: 6) } + +} + + +/// Generated service type to handle persisting and reading entity data. Exposed through `NoteStruct.EntityBindingType`. +internal class NoteStructBinding: ObjectBox.EntityBinding { + internal typealias EntityType = NoteStruct + internal typealias IdType = Id + + internal required init() {} + + internal func generatorBindingVersion() -> Int { 1 } + + internal func setStructEntityId(of entity: inout EntityType, to entityId: ObjectBox.Id) { + entity.__setId(identifier: entityId) + } + + internal func entityId(of entity: EntityType) -> ObjectBox.Id { + return entity.id.value + } + + internal func collect(fromEntity entity: EntityType, id: ObjectBox.Id, + propertyCollector: ObjectBox.FlatBufferBuilder, store: ObjectBox.Store) throws { + let propertyOffset_title = propertyCollector.prepare(string: entity.title) + let propertyOffset_text = propertyCollector.prepare(string: entity.text) + + propertyCollector.collect(id, at: 2 + 2 * 1) + propertyCollector.collect(entity.creationDate, at: 2 + 2 * 4) + propertyCollector.collect(entity.modificationDate, at: 2 + 2 * 5) + try propertyCollector.collect(entity.author, at: 2 + 2 * 6, store: store) + propertyCollector.collect(dataOffset: propertyOffset_title, at: 2 + 2 * 2) + propertyCollector.collect(dataOffset: propertyOffset_text, at: 2 + 2 * 3) + } + + internal func setToOneRelation(_ propertyId: obx_schema_id, of entity: EntityType, to entityId: ObjectBox.Id?) { + switch propertyId { + case 6: + entity.author.targetId = (entityId != nil) ? EntityId(entityId!) : nil + default: + fatalError("Attempt to change nonexistent ToOne relation with ID \(propertyId)") + } + } + internal func createEntity(entityReader: ObjectBox.FlatBufferReader, store: ObjectBox.Store) -> EntityType { + let entityId: Id = entityReader.read(at: 2 + 2 * 1) + let entity = NoteStruct( + id: entityId, + title: entityReader.read(at: 2 + 2 * 2), + text: entityReader.read(at: 2 + 2 * 3), + creationDate: entityReader.read(at: 2 + 2 * 4), + modificationDate: entityReader.read(at: 2 + 2 * 5), + author: entityReader.read(at: 2 + 2 * 6, store: store) + ) + return entity + } +} + +extension ObjectBox.Box where E == NoteStruct { + + /// Puts the NoteStruct in the box (aka persisting it) returning a copy with the ID updated to the ID it + /// has been assigned. + /// If you know the entity has already been persisted, you can use put() to avoid the cost of the copy. + /// + /// - Parameter entity: Object to persist. + /// - Returns: The stored object. If `entity`'s id is 0, an ID is generated. + /// - Throws: ObjectBoxError errors for database write errors. + func put(struct entity: NoteStruct) throws -> NoteStruct { + let entityId: NoteStruct.EntityBindingType.IdType = try self.put(entity) + + return NoteStruct( + id: entityId, + title: entity.title, + text: entity.text, + creationDate: entity.creationDate, + modificationDate: entity.modificationDate, + author: entity.author + ) + } + + /// Puts the NoteStructs in the box (aka persisting it) returning copies with their IDs updated to the + /// IDs they've been assigned. + /// If you know all entities have already been persisted, you can use put() to avoid the cost of the + /// copies. + /// + /// - Parameter entities: Objects to persist. + /// - Returns: The stored objects. If any entity's id is 0, an ID is generated. + /// - Throws: ObjectBoxError errors for database write errors. + func put(structs entities: [NoteStruct]) throws -> [NoteStruct] { + let entityIds: [NoteStruct.EntityBindingType.IdType] = try self.putAndReturnIDs(entities) + var newEntities = [NoteStruct]() + newEntities.reserveCapacity(entities.count) + + for i in 0 ..< min(entities.count, entityIds.count) { + let entity = entities[i] + let entityId = entityIds[i] + + newEntities.append(NoteStruct( + id: entityId, + title: entity.title, + text: entity.text, + creationDate: entity.creationDate, + modificationDate: entity.modificationDate, + author: entity.author + )) + } + + return newEntities + } +} + + +extension Student: ObjectBox.__EntityRelatable { + internal typealias EntityType = Student + + internal var _id: EntityId { + return EntityId(self.id.value) + } +} + +extension Student: ObjectBox.EntityInspectable { + internal typealias EntityBindingType = StudentBinding + + /// Generated metadata used by ObjectBox to persist the entity. + internal static var entityInfo = ObjectBox.EntityInfo(name: "Student", id: 5) + + internal static var entityBinding = EntityBindingType() + + fileprivate static func buildEntity(modelBuilder: ObjectBox.ModelBuilder) throws { + let entityBuilder = try modelBuilder.entityBuilder(for: Student.self, id: 5, uid: 7762515417864690432) + try entityBuilder.addProperty(name: "id", type: PropertyType.long, flags: [.id], id: 1, uid: 5805489249593327360) + try entityBuilder.addProperty(name: "name", type: PropertyType.string, id: 2, uid: 2830525844876407040) + try entityBuilder.addToManyRelation(id: 3, uid: 417604695477796352, + targetId: 6, targetUid: 4388202328849468160) + + try entityBuilder.lastProperty(id: 2, uid: 2830525844876407040) + } +} + +extension Student { + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { Student.id == myId } + internal static var id: Property { return Property(propertyId: 1, isPrimaryKey: true) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { Student.name.startsWith("X") } + internal static var name: Property { return Property(propertyId: 2, isPrimaryKey: false) } + /// Use `Student.teachers` to refer to this ToMany relation property in queries, + /// like when using `QueryBuilder.and(property:, conditions:)`. + + internal static var teachers: ToManyProperty { return ToManyProperty(.relationId(3)) } + + + fileprivate func __setId(identifier: ObjectBox.Id) { + self.id = Id(identifier) + } +} + +extension ObjectBox.Property where E == Student { + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .id == myId } + + internal static var id: Property { return Property(propertyId: 1, isPrimaryKey: true) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .name.startsWith("X") } + + internal static var name: Property { return Property(propertyId: 2, isPrimaryKey: false) } + + /// Use `.teachers` to refer to this ToMany relation property in queries, like when using + /// `QueryBuilder.and(property:, conditions:)`. + + internal static var teachers: ToManyProperty { return ToManyProperty(.relationId(3)) } + +} + + +/// Generated service type to handle persisting and reading entity data. Exposed through `Student.EntityBindingType`. +internal class StudentBinding: ObjectBox.EntityBinding { + internal typealias EntityType = Student + internal typealias IdType = Id + + internal required init() {} + + internal func generatorBindingVersion() -> Int { 1 } + + internal func setEntityIdUnlessStruct(of entity: EntityType, to entityId: ObjectBox.Id) { + entity.__setId(identifier: entityId) + } + + internal func entityId(of entity: EntityType) -> ObjectBox.Id { + return entity.id.value + } + + internal func collect(fromEntity entity: EntityType, id: ObjectBox.Id, + propertyCollector: ObjectBox.FlatBufferBuilder, store: ObjectBox.Store) throws { + let propertyOffset_name = propertyCollector.prepare(string: entity.name) + + propertyCollector.collect(id, at: 2 + 2 * 1) + propertyCollector.collect(dataOffset: propertyOffset_name, at: 2 + 2 * 2) + } + + internal func postPut(fromEntity entity: EntityType, id: ObjectBox.Id, store: ObjectBox.Store) throws { + if entityId(of: entity) == 0 { // New object was put? Attach relations now that we have an ID. + let teachers = ToMany.relation( + sourceId: EntityId(id.value), + targetBox: store.box(for: ToMany.ReferencedType.self), + relationId: 3) + if !entity.teachers.isEmpty { + teachers.replace(entity.teachers) + } + entity.teachers = teachers + try entity.teachers.applyToDb() + } + } + internal func createEntity(entityReader: ObjectBox.FlatBufferReader, store: ObjectBox.Store) -> EntityType { + let entity = Student() + + entity.id = entityReader.read(at: 2 + 2 * 1) + entity.name = entityReader.read(at: 2 + 2 * 2) + + entity.teachers = ToMany.relation( + sourceId: EntityId(entity.id.value), + targetBox: store.box(for: ToMany.ReferencedType.self), + relationId: 3) + return entity + } +} + + + +extension Teacher: ObjectBox.__EntityRelatable { + internal typealias EntityType = Teacher + + internal var _id: EntityId { + return EntityId(self.id.value) + } +} + +extension Teacher: ObjectBox.EntityInspectable { + internal typealias EntityBindingType = TeacherBinding + + /// Generated metadata used by ObjectBox to persist the entity. + internal static var entityInfo = ObjectBox.EntityInfo(name: "Teacher", id: 6) + + internal static var entityBinding = EntityBindingType() + + fileprivate static func buildEntity(modelBuilder: ObjectBox.ModelBuilder) throws { + let entityBuilder = try modelBuilder.entityBuilder(for: Teacher.self, id: 6, uid: 4388202328849468160) + try entityBuilder.addProperty(name: "id", type: PropertyType.long, flags: [.id], id: 1, uid: 2783284586616908288) + try entityBuilder.addProperty(name: "name", type: PropertyType.string, id: 2, uid: 5715806910771247872) + + try entityBuilder.lastProperty(id: 2, uid: 5715806910771247872) + } +} + +extension Teacher { + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { Teacher.id == myId } + internal static var id: Property { return Property(propertyId: 1, isPrimaryKey: true) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { Teacher.name.startsWith("X") } + internal static var name: Property { return Property(propertyId: 2, isPrimaryKey: false) } + /// Use `Teacher.students` to refer to this ToMany relation property in queries, + /// like when using `QueryBuilder.and(property:, conditions:)`. + + internal static var students: ToManyProperty { return ToManyProperty(.backlinkRelationId(3)) } + + + fileprivate func __setId(identifier: ObjectBox.Id) { + self.id = Id(identifier) + } +} + +extension ObjectBox.Property where E == Teacher { + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .id == myId } + + internal static var id: Property { return Property(propertyId: 1, isPrimaryKey: true) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .name.startsWith("X") } + + internal static var name: Property { return Property(propertyId: 2, isPrimaryKey: false) } + + /// Use `.students` to refer to this ToMany relation property in queries, like when using + /// `QueryBuilder.and(property:, conditions:)`. + + internal static var students: ToManyProperty { return ToManyProperty(.backlinkRelationId(3)) } + +} + + +/// Generated service type to handle persisting and reading entity data. Exposed through `Teacher.EntityBindingType`. +internal class TeacherBinding: ObjectBox.EntityBinding { + internal typealias EntityType = Teacher + internal typealias IdType = Id + + internal required init() {} + + internal func generatorBindingVersion() -> Int { 1 } + + internal func setEntityIdUnlessStruct(of entity: EntityType, to entityId: ObjectBox.Id) { + entity.__setId(identifier: entityId) + } + + internal func entityId(of entity: EntityType) -> ObjectBox.Id { + return entity.id.value + } + + internal func collect(fromEntity entity: EntityType, id: ObjectBox.Id, + propertyCollector: ObjectBox.FlatBufferBuilder, store: ObjectBox.Store) throws { + let propertyOffset_name = propertyCollector.prepare(string: entity.name) + + propertyCollector.collect(id, at: 2 + 2 * 1) + propertyCollector.collect(dataOffset: propertyOffset_name, at: 2 + 2 * 2) + } + + internal func postPut(fromEntity entity: EntityType, id: ObjectBox.Id, store: ObjectBox.Store) throws { + if entityId(of: entity) == 0 { // New object was put? Attach relations now that we have an ID. + let students = ToMany.backlink( + sourceBox: store.box(for: ToMany.ReferencedType.self), + targetId: EntityId(id.value), + relationId: 3) + if !entity.students.isEmpty { + students.replace(entity.students) + } + entity.students = students + try entity.students.applyToDb() + } + } + internal func createEntity(entityReader: ObjectBox.FlatBufferReader, store: ObjectBox.Store) -> EntityType { + let entity = Teacher() + + entity.id = entityReader.read(at: 2 + 2 * 1) + entity.name = entityReader.read(at: 2 + 2 * 2) + + entity.students = ToMany.backlink( + sourceBox: store.box(for: ToMany.ReferencedType.self), + targetId: EntityId(entity.id.value), + relationId: 3) + return entity + } +} + + + +extension UniqueEntity: ObjectBox.__EntityRelatable { + internal typealias EntityType = UniqueEntity + + internal var _id: EntityId { + return EntityId(self.id.value) + } +} + +extension UniqueEntity: ObjectBox.EntityInspectable { + internal typealias EntityBindingType = UniqueEntityBinding + + /// Generated metadata used by ObjectBox to persist the entity. + internal static var entityInfo = ObjectBox.EntityInfo(name: "UniqueEntity", id: 7) + + internal static var entityBinding = EntityBindingType() + + fileprivate static func buildEntity(modelBuilder: ObjectBox.ModelBuilder) throws { + let entityBuilder = try modelBuilder.entityBuilder(for: UniqueEntity.self, id: 7, uid: 6258744021471265280) + try entityBuilder.addProperty(name: "id", type: PropertyType.long, flags: [.id], id: 1, uid: 8418474383607017216) + try entityBuilder.addProperty(name: "name", type: PropertyType.string, flags: [.unique, .indexHash, .indexed], id: 2, uid: 6588651899515438336, indexId: 3, indexUid: 4943227758701996288) + try entityBuilder.addProperty(name: "content", type: PropertyType.string, id: 3, uid: 2295067898156422912) + try entityBuilder.addProperty(name: "content2", type: PropertyType.string, id: 4, uid: 8083811964173041920) + try entityBuilder.addProperty(name: "str1", type: PropertyType.string, id: 5, uid: 2085921255424893696) + try entityBuilder.addProperty(name: "str2", type: PropertyType.string, id: 6, uid: 3046539664613253632) + try entityBuilder.addProperty(name: "str3", type: PropertyType.string, id: 7, uid: 4836319770403460352) + try entityBuilder.addProperty(name: "str4", type: PropertyType.string, id: 8, uid: 5586670376507097344) + try entityBuilder.addProperty(name: "str5", type: PropertyType.string, id: 9, uid: 8779305452755862528) + try entityBuilder.addProperty(name: "str6", type: PropertyType.string, id: 10, uid: 7042629853749457152) + try entityBuilder.addProperty(name: "str7", type: PropertyType.string, id: 11, uid: 439706265026898176) + try entityBuilder.addProperty(name: "str8", type: PropertyType.string, id: 12, uid: 7797853325787760640) + try entityBuilder.addProperty(name: "str9", type: PropertyType.string, id: 13, uid: 6241625149586299904) + try entityBuilder.addProperty(name: "str10", type: PropertyType.string, id: 14, uid: 3838386263292640000) + try entityBuilder.addProperty(name: "str11", type: PropertyType.string, id: 15, uid: 2743032249190027008) + try entityBuilder.addProperty(name: "str12", type: PropertyType.string, id: 16, uid: 6199657977327115264) + try entityBuilder.addProperty(name: "str13", type: PropertyType.string, id: 17, uid: 6070699861433961728) + try entityBuilder.addProperty(name: "str14", type: PropertyType.string, id: 18, uid: 6029297771178376192) + try entityBuilder.addProperty(name: "str15", type: PropertyType.string, id: 19, uid: 3801959474204611328) + try entityBuilder.addProperty(name: "str16", type: PropertyType.string, id: 20, uid: 4774675437756918784) + try entityBuilder.addProperty(name: "str17", type: PropertyType.string, id: 21, uid: 8716823039315984640) + try entityBuilder.addProperty(name: "str18", type: PropertyType.string, id: 22, uid: 8894733078890829312) + try entityBuilder.addProperty(name: "str19", type: PropertyType.string, id: 23, uid: 1016331229052728320) + try entityBuilder.addProperty(name: "str20", type: PropertyType.string, id: 24, uid: 7810872262587479552) + try entityBuilder.addProperty(name: "str21", type: PropertyType.string, id: 25, uid: 4945264553128454912) + try entityBuilder.addProperty(name: "str22", type: PropertyType.string, id: 26, uid: 7152265273971458560) + try entityBuilder.addProperty(name: "str23", type: PropertyType.string, id: 27, uid: 6294538152931964672) + try entityBuilder.addProperty(name: "str24", type: PropertyType.string, id: 28, uid: 1939674925644995328) + try entityBuilder.addProperty(name: "str25", type: PropertyType.string, id: 29, uid: 2630803146682539264) + try entityBuilder.addProperty(name: "str26", type: PropertyType.string, id: 30, uid: 2158082104313626880) + try entityBuilder.addProperty(name: "str27", type: PropertyType.string, id: 31, uid: 4342475978535002368) + try entityBuilder.addProperty(name: "str28", type: PropertyType.string, id: 32, uid: 2618142912991854080) + try entityBuilder.addProperty(name: "str29", type: PropertyType.string, id: 33, uid: 4257312550012133632) + try entityBuilder.addProperty(name: "str30", type: PropertyType.string, id: 34, uid: 6658936396910379008) + try entityBuilder.addProperty(name: "str31", type: PropertyType.string, id: 35, uid: 7163695098896884992) + try entityBuilder.addProperty(name: "str32", type: PropertyType.string, id: 36, uid: 7792683921785881088) + try entityBuilder.addProperty(name: "str33", type: PropertyType.string, id: 37, uid: 2422385911045001728) + try entityBuilder.addProperty(name: "str34", type: PropertyType.string, id: 38, uid: 672123555343571712) + try entityBuilder.addProperty(name: "str35", type: PropertyType.string, id: 39, uid: 3356171792266690304) + try entityBuilder.addProperty(name: "str36", type: PropertyType.string, id: 40, uid: 8097607156277667584) + try entityBuilder.addProperty(name: "str37", type: PropertyType.string, id: 41, uid: 5877691172915301888) + try entityBuilder.addProperty(name: "str38", type: PropertyType.string, id: 42, uid: 7464585023102901248) + try entityBuilder.addProperty(name: "str39", type: PropertyType.string, id: 43, uid: 8211367673094595840) + try entityBuilder.addProperty(name: "str40", type: PropertyType.string, id: 44, uid: 123610260452597504) + try entityBuilder.addProperty(name: "str41", type: PropertyType.string, id: 45, uid: 2650611557939850240) + try entityBuilder.addProperty(name: "str42", type: PropertyType.string, id: 46, uid: 8393105718552925184) + try entityBuilder.addProperty(name: "str43", type: PropertyType.string, id: 47, uid: 6619994367521497344) + try entityBuilder.addProperty(name: "str44", type: PropertyType.string, id: 48, uid: 4805478268913715712) + try entityBuilder.addProperty(name: "str45", type: PropertyType.string, id: 49, uid: 8642866290657149184) + try entityBuilder.addProperty(name: "str46", type: PropertyType.string, id: 50, uid: 5061363131252470016) + try entityBuilder.addProperty(name: "str47", type: PropertyType.string, id: 51, uid: 4113947004423223040) + try entityBuilder.addProperty(name: "str48", type: PropertyType.string, id: 52, uid: 9141471831020050944) + try entityBuilder.addProperty(name: "str49", type: PropertyType.string, id: 53, uid: 938475961386865664) + try entityBuilder.addProperty(name: "str50", type: PropertyType.string, id: 54, uid: 2610097445773727232) + try entityBuilder.addProperty(name: "str51", type: PropertyType.string, id: 55, uid: 8223075157327230976) + try entityBuilder.addProperty(name: "str52", type: PropertyType.string, id: 56, uid: 6658701894057099520) + try entityBuilder.addProperty(name: "str53", type: PropertyType.string, id: 57, uid: 4320563155554460672) + try entityBuilder.addProperty(name: "str54", type: PropertyType.string, id: 58, uid: 3648783095476185088) + try entityBuilder.addProperty(name: "str55", type: PropertyType.string, id: 59, uid: 7718378802309229824) + try entityBuilder.addProperty(name: "str56", type: PropertyType.string, id: 60, uid: 7657786762797563392) + try entityBuilder.addProperty(name: "str57", type: PropertyType.string, id: 61, uid: 729766303749804544) + try entityBuilder.addProperty(name: "str58", type: PropertyType.string, id: 62, uid: 8250473843241116672) + try entityBuilder.addProperty(name: "str59", type: PropertyType.string, id: 63, uid: 4473980843763389184) + + try entityBuilder.lastProperty(id: 63, uid: 4473980843763389184) + } +} + +extension UniqueEntity { + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.id == myId } + internal static var id: Property { return Property(propertyId: 1, isPrimaryKey: true) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.name.startsWith("X") } + internal static var name: Property { return Property(propertyId: 2, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.content.startsWith("X") } + internal static var content: Property { return Property(propertyId: 3, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.content2.startsWith("X") } + internal static var content2: Property { return Property(propertyId: 4, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str1.startsWith("X") } + internal static var str1: Property { return Property(propertyId: 5, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str2.startsWith("X") } + internal static var str2: Property { return Property(propertyId: 6, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str3.startsWith("X") } + internal static var str3: Property { return Property(propertyId: 7, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str4.startsWith("X") } + internal static var str4: Property { return Property(propertyId: 8, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str5.startsWith("X") } + internal static var str5: Property { return Property(propertyId: 9, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str6.startsWith("X") } + internal static var str6: Property { return Property(propertyId: 10, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str7.startsWith("X") } + internal static var str7: Property { return Property(propertyId: 11, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str8.startsWith("X") } + internal static var str8: Property { return Property(propertyId: 12, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str9.startsWith("X") } + internal static var str9: Property { return Property(propertyId: 13, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str10.startsWith("X") } + internal static var str10: Property { return Property(propertyId: 14, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str11.startsWith("X") } + internal static var str11: Property { return Property(propertyId: 15, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str12.startsWith("X") } + internal static var str12: Property { return Property(propertyId: 16, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str13.startsWith("X") } + internal static var str13: Property { return Property(propertyId: 17, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str14.startsWith("X") } + internal static var str14: Property { return Property(propertyId: 18, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str15.startsWith("X") } + internal static var str15: Property { return Property(propertyId: 19, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str16.startsWith("X") } + internal static var str16: Property { return Property(propertyId: 20, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str17.startsWith("X") } + internal static var str17: Property { return Property(propertyId: 21, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str18.startsWith("X") } + internal static var str18: Property { return Property(propertyId: 22, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str19.startsWith("X") } + internal static var str19: Property { return Property(propertyId: 23, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str20.startsWith("X") } + internal static var str20: Property { return Property(propertyId: 24, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str21.startsWith("X") } + internal static var str21: Property { return Property(propertyId: 25, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str22.startsWith("X") } + internal static var str22: Property { return Property(propertyId: 26, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str23.startsWith("X") } + internal static var str23: Property { return Property(propertyId: 27, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str24.startsWith("X") } + internal static var str24: Property { return Property(propertyId: 28, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str25.startsWith("X") } + internal static var str25: Property { return Property(propertyId: 29, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str26.startsWith("X") } + internal static var str26: Property { return Property(propertyId: 30, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str27.startsWith("X") } + internal static var str27: Property { return Property(propertyId: 31, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str28.startsWith("X") } + internal static var str28: Property { return Property(propertyId: 32, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str29.startsWith("X") } + internal static var str29: Property { return Property(propertyId: 33, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str30.startsWith("X") } + internal static var str30: Property { return Property(propertyId: 34, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str31.startsWith("X") } + internal static var str31: Property { return Property(propertyId: 35, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str32.startsWith("X") } + internal static var str32: Property { return Property(propertyId: 36, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str33.startsWith("X") } + internal static var str33: Property { return Property(propertyId: 37, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str34.startsWith("X") } + internal static var str34: Property { return Property(propertyId: 38, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str35.startsWith("X") } + internal static var str35: Property { return Property(propertyId: 39, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str36.startsWith("X") } + internal static var str36: Property { return Property(propertyId: 40, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str37.startsWith("X") } + internal static var str37: Property { return Property(propertyId: 41, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str38.startsWith("X") } + internal static var str38: Property { return Property(propertyId: 42, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str39.startsWith("X") } + internal static var str39: Property { return Property(propertyId: 43, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str40.startsWith("X") } + internal static var str40: Property { return Property(propertyId: 44, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str41.startsWith("X") } + internal static var str41: Property { return Property(propertyId: 45, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str42.startsWith("X") } + internal static var str42: Property { return Property(propertyId: 46, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str43.startsWith("X") } + internal static var str43: Property { return Property(propertyId: 47, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str44.startsWith("X") } + internal static var str44: Property { return Property(propertyId: 48, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str45.startsWith("X") } + internal static var str45: Property { return Property(propertyId: 49, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str46.startsWith("X") } + internal static var str46: Property { return Property(propertyId: 50, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str47.startsWith("X") } + internal static var str47: Property { return Property(propertyId: 51, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str48.startsWith("X") } + internal static var str48: Property { return Property(propertyId: 52, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str49.startsWith("X") } + internal static var str49: Property { return Property(propertyId: 53, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str50.startsWith("X") } + internal static var str50: Property { return Property(propertyId: 54, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str51.startsWith("X") } + internal static var str51: Property { return Property(propertyId: 55, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str52.startsWith("X") } + internal static var str52: Property { return Property(propertyId: 56, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str53.startsWith("X") } + internal static var str53: Property { return Property(propertyId: 57, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str54.startsWith("X") } + internal static var str54: Property { return Property(propertyId: 58, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str55.startsWith("X") } + internal static var str55: Property { return Property(propertyId: 59, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str56.startsWith("X") } + internal static var str56: Property { return Property(propertyId: 60, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str57.startsWith("X") } + internal static var str57: Property { return Property(propertyId: 61, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str58.startsWith("X") } + internal static var str58: Property { return Property(propertyId: 62, isPrimaryKey: false) } + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { UniqueEntity.str59.startsWith("X") } + internal static var str59: Property { return Property(propertyId: 63, isPrimaryKey: false) } + + fileprivate func __setId(identifier: ObjectBox.Id) { + self.id = Id(identifier) + } +} + +extension ObjectBox.Property where E == UniqueEntity { + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .id == myId } + + internal static var id: Property { return Property(propertyId: 1, isPrimaryKey: true) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .name.startsWith("X") } + + internal static var name: Property { return Property(propertyId: 2, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .content.startsWith("X") } + + internal static var content: Property { return Property(propertyId: 3, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .content2.startsWith("X") } + + internal static var content2: Property { return Property(propertyId: 4, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str1.startsWith("X") } + + internal static var str1: Property { return Property(propertyId: 5, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str2.startsWith("X") } + + internal static var str2: Property { return Property(propertyId: 6, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str3.startsWith("X") } + + internal static var str3: Property { return Property(propertyId: 7, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str4.startsWith("X") } + + internal static var str4: Property { return Property(propertyId: 8, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str5.startsWith("X") } + + internal static var str5: Property { return Property(propertyId: 9, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str6.startsWith("X") } + + internal static var str6: Property { return Property(propertyId: 10, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str7.startsWith("X") } + + internal static var str7: Property { return Property(propertyId: 11, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str8.startsWith("X") } + + internal static var str8: Property { return Property(propertyId: 12, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str9.startsWith("X") } + + internal static var str9: Property { return Property(propertyId: 13, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str10.startsWith("X") } + + internal static var str10: Property { return Property(propertyId: 14, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str11.startsWith("X") } + + internal static var str11: Property { return Property(propertyId: 15, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str12.startsWith("X") } + + internal static var str12: Property { return Property(propertyId: 16, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str13.startsWith("X") } + + internal static var str13: Property { return Property(propertyId: 17, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str14.startsWith("X") } + + internal static var str14: Property { return Property(propertyId: 18, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str15.startsWith("X") } + + internal static var str15: Property { return Property(propertyId: 19, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str16.startsWith("X") } + + internal static var str16: Property { return Property(propertyId: 20, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str17.startsWith("X") } + + internal static var str17: Property { return Property(propertyId: 21, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str18.startsWith("X") } + + internal static var str18: Property { return Property(propertyId: 22, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str19.startsWith("X") } + + internal static var str19: Property { return Property(propertyId: 23, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str20.startsWith("X") } + + internal static var str20: Property { return Property(propertyId: 24, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str21.startsWith("X") } + + internal static var str21: Property { return Property(propertyId: 25, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str22.startsWith("X") } + + internal static var str22: Property { return Property(propertyId: 26, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str23.startsWith("X") } + + internal static var str23: Property { return Property(propertyId: 27, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str24.startsWith("X") } + + internal static var str24: Property { return Property(propertyId: 28, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str25.startsWith("X") } + + internal static var str25: Property { return Property(propertyId: 29, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str26.startsWith("X") } + + internal static var str26: Property { return Property(propertyId: 30, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str27.startsWith("X") } + + internal static var str27: Property { return Property(propertyId: 31, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str28.startsWith("X") } + + internal static var str28: Property { return Property(propertyId: 32, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str29.startsWith("X") } + + internal static var str29: Property { return Property(propertyId: 33, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str30.startsWith("X") } + + internal static var str30: Property { return Property(propertyId: 34, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str31.startsWith("X") } + + internal static var str31: Property { return Property(propertyId: 35, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str32.startsWith("X") } + + internal static var str32: Property { return Property(propertyId: 36, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str33.startsWith("X") } + + internal static var str33: Property { return Property(propertyId: 37, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str34.startsWith("X") } + + internal static var str34: Property { return Property(propertyId: 38, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str35.startsWith("X") } + + internal static var str35: Property { return Property(propertyId: 39, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str36.startsWith("X") } + + internal static var str36: Property { return Property(propertyId: 40, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str37.startsWith("X") } + + internal static var str37: Property { return Property(propertyId: 41, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str38.startsWith("X") } + + internal static var str38: Property { return Property(propertyId: 42, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str39.startsWith("X") } + + internal static var str39: Property { return Property(propertyId: 43, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str40.startsWith("X") } + + internal static var str40: Property { return Property(propertyId: 44, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str41.startsWith("X") } + + internal static var str41: Property { return Property(propertyId: 45, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str42.startsWith("X") } + + internal static var str42: Property { return Property(propertyId: 46, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str43.startsWith("X") } + + internal static var str43: Property { return Property(propertyId: 47, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str44.startsWith("X") } + + internal static var str44: Property { return Property(propertyId: 48, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str45.startsWith("X") } + + internal static var str45: Property { return Property(propertyId: 49, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str46.startsWith("X") } + + internal static var str46: Property { return Property(propertyId: 50, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str47.startsWith("X") } + + internal static var str47: Property { return Property(propertyId: 51, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str48.startsWith("X") } + + internal static var str48: Property { return Property(propertyId: 52, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str49.startsWith("X") } + + internal static var str49: Property { return Property(propertyId: 53, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str50.startsWith("X") } + + internal static var str50: Property { return Property(propertyId: 54, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str51.startsWith("X") } + + internal static var str51: Property { return Property(propertyId: 55, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str52.startsWith("X") } + + internal static var str52: Property { return Property(propertyId: 56, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str53.startsWith("X") } + + internal static var str53: Property { return Property(propertyId: 57, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str54.startsWith("X") } + + internal static var str54: Property { return Property(propertyId: 58, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str55.startsWith("X") } + + internal static var str55: Property { return Property(propertyId: 59, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str56.startsWith("X") } + + internal static var str56: Property { return Property(propertyId: 60, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str57.startsWith("X") } + + internal static var str57: Property { return Property(propertyId: 61, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str58.startsWith("X") } + + internal static var str58: Property { return Property(propertyId: 62, isPrimaryKey: false) } + + /// Generated entity property information. + /// + /// You may want to use this in queries to specify fetch conditions, for example: + /// + /// box.query { .str59.startsWith("X") } + + internal static var str59: Property { return Property(propertyId: 63, isPrimaryKey: false) } + +} + + +/// Generated service type to handle persisting and reading entity data. Exposed through `UniqueEntity.EntityBindingType`. +internal class UniqueEntityBinding: ObjectBox.EntityBinding { + internal typealias EntityType = UniqueEntity + internal typealias IdType = Id + + internal required init() {} + + internal func generatorBindingVersion() -> Int { 1 } + + internal func setEntityIdUnlessStruct(of entity: EntityType, to entityId: ObjectBox.Id) { + entity.__setId(identifier: entityId) + } + + internal func entityId(of entity: EntityType) -> ObjectBox.Id { + return entity.id.value + } + + internal func collect(fromEntity entity: EntityType, id: ObjectBox.Id, + propertyCollector: ObjectBox.FlatBufferBuilder, store: ObjectBox.Store) throws { + let propertyOffset_name = propertyCollector.prepare(string: entity.name) + let propertyOffset_content = propertyCollector.prepare(string: entity.content) + let propertyOffset_content2 = propertyCollector.prepare(string: entity.content2) + let propertyOffset_str1 = propertyCollector.prepare(string: entity.str1) + let propertyOffset_str2 = propertyCollector.prepare(string: entity.str2) + let propertyOffset_str3 = propertyCollector.prepare(string: entity.str3) + let propertyOffset_str4 = propertyCollector.prepare(string: entity.str4) + let propertyOffset_str5 = propertyCollector.prepare(string: entity.str5) + let propertyOffset_str6 = propertyCollector.prepare(string: entity.str6) + let propertyOffset_str7 = propertyCollector.prepare(string: entity.str7) + let propertyOffset_str8 = propertyCollector.prepare(string: entity.str8) + let propertyOffset_str9 = propertyCollector.prepare(string: entity.str9) + let propertyOffset_str10 = propertyCollector.prepare(string: entity.str10) + let propertyOffset_str11 = propertyCollector.prepare(string: entity.str11) + let propertyOffset_str12 = propertyCollector.prepare(string: entity.str12) + let propertyOffset_str13 = propertyCollector.prepare(string: entity.str13) + let propertyOffset_str14 = propertyCollector.prepare(string: entity.str14) + let propertyOffset_str15 = propertyCollector.prepare(string: entity.str15) + let propertyOffset_str16 = propertyCollector.prepare(string: entity.str16) + let propertyOffset_str17 = propertyCollector.prepare(string: entity.str17) + let propertyOffset_str18 = propertyCollector.prepare(string: entity.str18) + let propertyOffset_str19 = propertyCollector.prepare(string: entity.str19) + let propertyOffset_str20 = propertyCollector.prepare(string: entity.str20) + let propertyOffset_str21 = propertyCollector.prepare(string: entity.str21) + let propertyOffset_str22 = propertyCollector.prepare(string: entity.str22) + let propertyOffset_str23 = propertyCollector.prepare(string: entity.str23) + let propertyOffset_str24 = propertyCollector.prepare(string: entity.str24) + let propertyOffset_str25 = propertyCollector.prepare(string: entity.str25) + let propertyOffset_str26 = propertyCollector.prepare(string: entity.str26) + let propertyOffset_str27 = propertyCollector.prepare(string: entity.str27) + let propertyOffset_str28 = propertyCollector.prepare(string: entity.str28) + let propertyOffset_str29 = propertyCollector.prepare(string: entity.str29) + let propertyOffset_str30 = propertyCollector.prepare(string: entity.str30) + let propertyOffset_str31 = propertyCollector.prepare(string: entity.str31) + let propertyOffset_str32 = propertyCollector.prepare(string: entity.str32) + let propertyOffset_str33 = propertyCollector.prepare(string: entity.str33) + let propertyOffset_str34 = propertyCollector.prepare(string: entity.str34) + let propertyOffset_str35 = propertyCollector.prepare(string: entity.str35) + let propertyOffset_str36 = propertyCollector.prepare(string: entity.str36) + let propertyOffset_str37 = propertyCollector.prepare(string: entity.str37) + let propertyOffset_str38 = propertyCollector.prepare(string: entity.str38) + let propertyOffset_str39 = propertyCollector.prepare(string: entity.str39) + let propertyOffset_str40 = propertyCollector.prepare(string: entity.str40) + let propertyOffset_str41 = propertyCollector.prepare(string: entity.str41) + let propertyOffset_str42 = propertyCollector.prepare(string: entity.str42) + let propertyOffset_str43 = propertyCollector.prepare(string: entity.str43) + let propertyOffset_str44 = propertyCollector.prepare(string: entity.str44) + let propertyOffset_str45 = propertyCollector.prepare(string: entity.str45) + let propertyOffset_str46 = propertyCollector.prepare(string: entity.str46) + let propertyOffset_str47 = propertyCollector.prepare(string: entity.str47) + let propertyOffset_str48 = propertyCollector.prepare(string: entity.str48) + let propertyOffset_str49 = propertyCollector.prepare(string: entity.str49) + let propertyOffset_str50 = propertyCollector.prepare(string: entity.str50) + let propertyOffset_str51 = propertyCollector.prepare(string: entity.str51) + let propertyOffset_str52 = propertyCollector.prepare(string: entity.str52) + let propertyOffset_str53 = propertyCollector.prepare(string: entity.str53) + let propertyOffset_str54 = propertyCollector.prepare(string: entity.str54) + let propertyOffset_str55 = propertyCollector.prepare(string: entity.str55) + let propertyOffset_str56 = propertyCollector.prepare(string: entity.str56) + let propertyOffset_str57 = propertyCollector.prepare(string: entity.str57) + let propertyOffset_str58 = propertyCollector.prepare(string: entity.str58) + let propertyOffset_str59 = propertyCollector.prepare(string: entity.str59) + + propertyCollector.collect(id, at: 2 + 2 * 1) + propertyCollector.collect(dataOffset: propertyOffset_name, at: 2 + 2 * 2) + propertyCollector.collect(dataOffset: propertyOffset_content, at: 2 + 2 * 3) + propertyCollector.collect(dataOffset: propertyOffset_content2, at: 2 + 2 * 4) + propertyCollector.collect(dataOffset: propertyOffset_str1, at: 2 + 2 * 5) + propertyCollector.collect(dataOffset: propertyOffset_str2, at: 2 + 2 * 6) + propertyCollector.collect(dataOffset: propertyOffset_str3, at: 2 + 2 * 7) + propertyCollector.collect(dataOffset: propertyOffset_str4, at: 2 + 2 * 8) + propertyCollector.collect(dataOffset: propertyOffset_str5, at: 2 + 2 * 9) + propertyCollector.collect(dataOffset: propertyOffset_str6, at: 2 + 2 * 10) + propertyCollector.collect(dataOffset: propertyOffset_str7, at: 2 + 2 * 11) + propertyCollector.collect(dataOffset: propertyOffset_str8, at: 2 + 2 * 12) + propertyCollector.collect(dataOffset: propertyOffset_str9, at: 2 + 2 * 13) + propertyCollector.collect(dataOffset: propertyOffset_str10, at: 2 + 2 * 14) + propertyCollector.collect(dataOffset: propertyOffset_str11, at: 2 + 2 * 15) + propertyCollector.collect(dataOffset: propertyOffset_str12, at: 2 + 2 * 16) + propertyCollector.collect(dataOffset: propertyOffset_str13, at: 2 + 2 * 17) + propertyCollector.collect(dataOffset: propertyOffset_str14, at: 2 + 2 * 18) + propertyCollector.collect(dataOffset: propertyOffset_str15, at: 2 + 2 * 19) + propertyCollector.collect(dataOffset: propertyOffset_str16, at: 2 + 2 * 20) + propertyCollector.collect(dataOffset: propertyOffset_str17, at: 2 + 2 * 21) + propertyCollector.collect(dataOffset: propertyOffset_str18, at: 2 + 2 * 22) + propertyCollector.collect(dataOffset: propertyOffset_str19, at: 2 + 2 * 23) + propertyCollector.collect(dataOffset: propertyOffset_str20, at: 2 + 2 * 24) + propertyCollector.collect(dataOffset: propertyOffset_str21, at: 2 + 2 * 25) + propertyCollector.collect(dataOffset: propertyOffset_str22, at: 2 + 2 * 26) + propertyCollector.collect(dataOffset: propertyOffset_str23, at: 2 + 2 * 27) + propertyCollector.collect(dataOffset: propertyOffset_str24, at: 2 + 2 * 28) + propertyCollector.collect(dataOffset: propertyOffset_str25, at: 2 + 2 * 29) + propertyCollector.collect(dataOffset: propertyOffset_str26, at: 2 + 2 * 30) + propertyCollector.collect(dataOffset: propertyOffset_str27, at: 2 + 2 * 31) + propertyCollector.collect(dataOffset: propertyOffset_str28, at: 2 + 2 * 32) + propertyCollector.collect(dataOffset: propertyOffset_str29, at: 2 + 2 * 33) + propertyCollector.collect(dataOffset: propertyOffset_str30, at: 2 + 2 * 34) + propertyCollector.collect(dataOffset: propertyOffset_str31, at: 2 + 2 * 35) + propertyCollector.collect(dataOffset: propertyOffset_str32, at: 2 + 2 * 36) + propertyCollector.collect(dataOffset: propertyOffset_str33, at: 2 + 2 * 37) + propertyCollector.collect(dataOffset: propertyOffset_str34, at: 2 + 2 * 38) + propertyCollector.collect(dataOffset: propertyOffset_str35, at: 2 + 2 * 39) + propertyCollector.collect(dataOffset: propertyOffset_str36, at: 2 + 2 * 40) + propertyCollector.collect(dataOffset: propertyOffset_str37, at: 2 + 2 * 41) + propertyCollector.collect(dataOffset: propertyOffset_str38, at: 2 + 2 * 42) + propertyCollector.collect(dataOffset: propertyOffset_str39, at: 2 + 2 * 43) + propertyCollector.collect(dataOffset: propertyOffset_str40, at: 2 + 2 * 44) + propertyCollector.collect(dataOffset: propertyOffset_str41, at: 2 + 2 * 45) + propertyCollector.collect(dataOffset: propertyOffset_str42, at: 2 + 2 * 46) + propertyCollector.collect(dataOffset: propertyOffset_str43, at: 2 + 2 * 47) + propertyCollector.collect(dataOffset: propertyOffset_str44, at: 2 + 2 * 48) + propertyCollector.collect(dataOffset: propertyOffset_str45, at: 2 + 2 * 49) + propertyCollector.collect(dataOffset: propertyOffset_str46, at: 2 + 2 * 50) + propertyCollector.collect(dataOffset: propertyOffset_str47, at: 2 + 2 * 51) + propertyCollector.collect(dataOffset: propertyOffset_str48, at: 2 + 2 * 52) + propertyCollector.collect(dataOffset: propertyOffset_str49, at: 2 + 2 * 53) + propertyCollector.collect(dataOffset: propertyOffset_str50, at: 2 + 2 * 54) + propertyCollector.collect(dataOffset: propertyOffset_str51, at: 2 + 2 * 55) + propertyCollector.collect(dataOffset: propertyOffset_str52, at: 2 + 2 * 56) + propertyCollector.collect(dataOffset: propertyOffset_str53, at: 2 + 2 * 57) + propertyCollector.collect(dataOffset: propertyOffset_str54, at: 2 + 2 * 58) + propertyCollector.collect(dataOffset: propertyOffset_str55, at: 2 + 2 * 59) + propertyCollector.collect(dataOffset: propertyOffset_str56, at: 2 + 2 * 60) + propertyCollector.collect(dataOffset: propertyOffset_str57, at: 2 + 2 * 61) + propertyCollector.collect(dataOffset: propertyOffset_str58, at: 2 + 2 * 62) + propertyCollector.collect(dataOffset: propertyOffset_str59, at: 2 + 2 * 63) + } + + internal func createEntity(entityReader: ObjectBox.FlatBufferReader, store: ObjectBox.Store) -> EntityType { + let entity = UniqueEntity() + + entity.id = entityReader.read(at: 2 + 2 * 1) + entity.name = entityReader.read(at: 2 + 2 * 2) + entity.content = entityReader.read(at: 2 + 2 * 3) + entity.content2 = entityReader.read(at: 2 + 2 * 4) + entity.str1 = entityReader.read(at: 2 + 2 * 5) + entity.str2 = entityReader.read(at: 2 + 2 * 6) + entity.str3 = entityReader.read(at: 2 + 2 * 7) + entity.str4 = entityReader.read(at: 2 + 2 * 8) + entity.str5 = entityReader.read(at: 2 + 2 * 9) + entity.str6 = entityReader.read(at: 2 + 2 * 10) + entity.str7 = entityReader.read(at: 2 + 2 * 11) + entity.str8 = entityReader.read(at: 2 + 2 * 12) + entity.str9 = entityReader.read(at: 2 + 2 * 13) + entity.str10 = entityReader.read(at: 2 + 2 * 14) + entity.str11 = entityReader.read(at: 2 + 2 * 15) + entity.str12 = entityReader.read(at: 2 + 2 * 16) + entity.str13 = entityReader.read(at: 2 + 2 * 17) + entity.str14 = entityReader.read(at: 2 + 2 * 18) + entity.str15 = entityReader.read(at: 2 + 2 * 19) + entity.str16 = entityReader.read(at: 2 + 2 * 20) + entity.str17 = entityReader.read(at: 2 + 2 * 21) + entity.str18 = entityReader.read(at: 2 + 2 * 22) + entity.str19 = entityReader.read(at: 2 + 2 * 23) + entity.str20 = entityReader.read(at: 2 + 2 * 24) + entity.str21 = entityReader.read(at: 2 + 2 * 25) + entity.str22 = entityReader.read(at: 2 + 2 * 26) + entity.str23 = entityReader.read(at: 2 + 2 * 27) + entity.str24 = entityReader.read(at: 2 + 2 * 28) + entity.str25 = entityReader.read(at: 2 + 2 * 29) + entity.str26 = entityReader.read(at: 2 + 2 * 30) + entity.str27 = entityReader.read(at: 2 + 2 * 31) + entity.str28 = entityReader.read(at: 2 + 2 * 32) + entity.str29 = entityReader.read(at: 2 + 2 * 33) + entity.str30 = entityReader.read(at: 2 + 2 * 34) + entity.str31 = entityReader.read(at: 2 + 2 * 35) + entity.str32 = entityReader.read(at: 2 + 2 * 36) + entity.str33 = entityReader.read(at: 2 + 2 * 37) + entity.str34 = entityReader.read(at: 2 + 2 * 38) + entity.str35 = entityReader.read(at: 2 + 2 * 39) + entity.str36 = entityReader.read(at: 2 + 2 * 40) + entity.str37 = entityReader.read(at: 2 + 2 * 41) + entity.str38 = entityReader.read(at: 2 + 2 * 42) + entity.str39 = entityReader.read(at: 2 + 2 * 43) + entity.str40 = entityReader.read(at: 2 + 2 * 44) + entity.str41 = entityReader.read(at: 2 + 2 * 45) + entity.str42 = entityReader.read(at: 2 + 2 * 46) + entity.str43 = entityReader.read(at: 2 + 2 * 47) + entity.str44 = entityReader.read(at: 2 + 2 * 48) + entity.str45 = entityReader.read(at: 2 + 2 * 49) + entity.str46 = entityReader.read(at: 2 + 2 * 50) + entity.str47 = entityReader.read(at: 2 + 2 * 51) + entity.str48 = entityReader.read(at: 2 + 2 * 52) + entity.str49 = entityReader.read(at: 2 + 2 * 53) + entity.str50 = entityReader.read(at: 2 + 2 * 54) + entity.str51 = entityReader.read(at: 2 + 2 * 55) + entity.str52 = entityReader.read(at: 2 + 2 * 56) + entity.str53 = entityReader.read(at: 2 + 2 * 57) + entity.str54 = entityReader.read(at: 2 + 2 * 58) + entity.str55 = entityReader.read(at: 2 + 2 * 59) + entity.str56 = entityReader.read(at: 2 + 2 * 60) + entity.str57 = entityReader.read(at: 2 + 2 * 61) + entity.str58 = entityReader.read(at: 2 + 2 * 62) + entity.str59 = entityReader.read(at: 2 + 2 * 63) + + return entity + } +} + + +/// Helper function that allows calling Enum(rawValue: value) with a nil value, which will return nil. +fileprivate func optConstruct(_ type: T.Type, rawValue: T.RawValue?) -> T? { + guard let rawValue = rawValue else { return nil } + return T(rawValue: rawValue) +} + +// MARK: - Store setup + +fileprivate func cModel() throws -> OpaquePointer { + let modelBuilder = try ObjectBox.ModelBuilder() + try Author.buildEntity(modelBuilder: modelBuilder) + try AuthorStruct.buildEntity(modelBuilder: modelBuilder) + try Note.buildEntity(modelBuilder: modelBuilder) + try NoteStruct.buildEntity(modelBuilder: modelBuilder) + try Student.buildEntity(modelBuilder: modelBuilder) + try Teacher.buildEntity(modelBuilder: modelBuilder) + try UniqueEntity.buildEntity(modelBuilder: modelBuilder) + modelBuilder.lastEntity(id: 7, uid: 6258744021471265280) + modelBuilder.lastIndex(id: 3, uid: 4943227758701996288) + modelBuilder.lastRelation(id: 3, uid: 417604695477796352) + return modelBuilder.finish() +} + +extension ObjectBox.Store { + /// A store with a fully configured model. Created by the code generator with your model's metadata in place. + /// + /// - Parameters: + /// - directoryPath: The directory path in which ObjectBox places its database files for this store. + /// - maxDbSizeInKByte: Limit of on-disk space for the database files. Default is `1024 * 1024` (1 GiB). + /// - fileMode: UNIX-style bit mask used for the database files; default is `0o644`. + /// Note: directories become searchable if the "read" or "write" permission is set (e.g. 0640 becomes 0750). + /// - maxReaders: The maximum number of readers. + /// "Readers" are a finite resource for which we need to define a maximum number upfront. + /// The default value is enough for most apps and usually you can ignore it completely. + /// However, if you get the maxReadersExceeded error, you should verify your + /// threading. For each thread, ObjectBox uses multiple readers. Their number (per thread) depends + /// on number of types, relations, and usage patterns. Thus, if you are working with many threads + /// (e.g. in a server-like scenario), it can make sense to increase the maximum number of readers. + /// Note: The internal default is currently around 120. + /// So when hitting this limit, try values around 200-500. + /// - important: This initializer is created by the code generator. If you only see the internal `init(model:...)` + /// initializer, trigger code generation by building your project. + internal convenience init(directoryPath: String, maxDbSizeInKByte: UInt64 = 1024 * 1024, + fileMode: UInt32 = 0o644, maxReaders: UInt32 = 0, readOnly: Bool = false) throws { + try self.init( + model: try cModel(), + directory: directoryPath, + maxDbSizeInKByte: maxDbSizeInKByte, + fileMode: fileMode, + maxReaders: maxReaders, + readOnly: readOnly) + } +} + +// swiftlint:enable all diff --git a/Source/ios-framework/CommonTests/Test Entities/generate.rb b/Source/ios-framework/CommonTests/Test Entities/generate.rb index 34faf01..31d16ab 100644 --- a/Source/ios-framework/CommonTests/Test Entities/generate.rb +++ b/Source/ios-framework/CommonTests/Test Entities/generate.rb @@ -1,9 +1,10 @@ CURR_PATH = File.expand_path(File.dirname(__FILE__)) SOURCES_PATH = CURR_PATH -TEMPLATES_PATH = File.join(CURR_PATH, "..", "..", "..", "EntityInfoTest", "templates") +GENERATOR_PATH = File.join(CURR_PATH, "..", "..", "..", "external", "objectbox-swift-generator") +TEMPLATES_PATH = File.join(GENERATOR_PATH, "ObjectBox") GENERATED_PATH = File.join(CURR_PATH) -SOURCERY_PATH = File.join(CURR_PATH, "..", "..", "..", "external", "Sourcery", ".build", "release", "sourcery") +SOURCERY_PATH = File.join(GENERATOR_PATH, "bin", "Sourcery.app", "Contents", "MacOS", "Sourcery") -Dir.glob(File.join(CURR_PATH, "*Entities.swift")) do |path| +Dir.glob(File.join(CURR_PATH, "Entities.swift")) do |path| # TODO: used to be multiple files via *, but not needed anymore? system %Q{"#{SOURCERY_PATH}" --verbose --disableCache --prune --sources "#{path}" --templates "#{TEMPLATES_PATH}" --output "#{GENERATED_PATH}"} end diff --git a/Source/ios-framework/CommonTests/Test Entities/model.json b/Source/ios-framework/CommonTests/Test Entities/model.json new file mode 100644 index 0000000..80d8756 --- /dev/null +++ b/Source/ios-framework/CommonTests/Test Entities/model.json @@ -0,0 +1,538 @@ +{ + "_note1": "KEEP THIS FILE! Check it into a version control system (VCS) like git.", + "_note2": "ObjectBox manages crucial IDs for your object model. See docs for details.", + "_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.", + "entities": [ + { + "id": "1:3576167000524145664", + "lastPropertyId": "3:6604692165263705088", + "name": "Author", + "properties": [ + { + "flags": 1, + "id": "1:4782546707843525376", + "name": "id", + "type": 6 + }, + { + "id": "2:8205028904652262144", + "name": "name", + "type": 9 + }, + { + "id": "3:6604692165263705088", + "name": "yearOfBirth", + "type": 3 + } + ], + "relations": [ + { + "id": "1:6166183021412625664", + "name": "notesStandalone", + "targetId": "3:8286413937822989568" + } + ] + }, + { + "id": "2:1229901451922443520", + "lastPropertyId": "2:2629753880188920064", + "name": "AuthorStruct", + "properties": [ + { + "flags": 1, + "id": "1:3324125320646150656", + "name": "id", + "type": 6 + }, + { + "id": "2:2629753880188920064", + "name": "name", + "type": 9 + } + ], + "relations": [ + { + "id": "2:7420642801495878912", + "name": "notes", + "targetId": "4:1267197271366405632" + } + ] + }, + { + "id": "3:8286413937822989568", + "lastPropertyId": "8:5856576790296241408", + "name": "Note", + "properties": [ + { + "flags": 1, + "id": "1:8202191337322996480", + "name": "id", + "type": 6 + }, + { + "id": "2:1350315346983447296", + "name": "title", + "type": 9 + }, + { + "id": "3:2156716490547525120", + "name": "text", + "type": 9 + }, + { + "id": "4:2259363133844796672", + "name": "creationDate", + "type": 10 + }, + { + "id": "5:6233774800911586048", + "name": "modificationDate", + "type": 10 + }, + { + "flags": 8, + "id": "6:6448513910062322432", + "indexId": "1:1458654215934992896", + "name": "author", + "relationTarget": "Author", + "type": 11 + }, + { + "id": "7:3390351202128481792", + "name": "done", + "type": 1 + }, + { + "flags": 8192, + "id": "8:5856576790296241408", + "name": "upvotes", + "type": 5 + } + ], + "relations": [] + }, + { + "id": "4:1267197271366405632", + "lastPropertyId": "6:2469372667932281088", + "name": "NoteStruct", + "properties": [ + { + "flags": 1, + "id": "1:2519416082326737408", + "name": "id", + "type": 6 + }, + { + "id": "2:551839225092133376", + "name": "title", + "type": 9 + }, + { + "id": "3:7011109989572489472", + "name": "text", + "type": 9 + }, + { + "id": "4:778896539487013376", + "name": "creationDate", + "type": 10 + }, + { + "id": "5:7303324335582009600", + "name": "modificationDate", + "type": 10 + }, + { + "flags": 8, + "id": "6:2469372667932281088", + "indexId": "2:6342353045634752256", + "name": "author", + "relationTarget": "Author", + "type": 11 + } + ], + "relations": [] + }, + { + "id": "5:7762515417864690432", + "lastPropertyId": "2:2830525844876407040", + "name": "Student", + "properties": [ + { + "flags": 1, + "id": "1:5805489249593327360", + "name": "id", + "type": 6 + }, + { + "id": "2:2830525844876407040", + "name": "name", + "type": 9 + } + ], + "relations": [ + { + "id": "3:417604695477796352", + "name": "teachers", + "targetId": "6:4388202328849468160" + } + ] + }, + { + "id": "6:4388202328849468160", + "lastPropertyId": "2:5715806910771247872", + "name": "Teacher", + "properties": [ + { + "flags": 1, + "id": "1:2783284586616908288", + "name": "id", + "type": 6 + }, + { + "id": "2:5715806910771247872", + "name": "name", + "type": 9 + } + ], + "relations": [] + }, + { + "id": "7:6258744021471265280", + "lastPropertyId": "63:4473980843763389184", + "name": "UniqueEntity", + "properties": [ + { + "flags": 1, + "id": "1:8418474383607017216", + "name": "id", + "type": 6 + }, + { + "flags": 2088, + "id": "2:6588651899515438336", + "indexId": "3:4943227758701996288", + "name": "name", + "type": 9 + }, + { + "id": "3:2295067898156422912", + "name": "content", + "type": 9 + }, + { + "id": "4:8083811964173041920", + "name": "content2", + "type": 9 + }, + { + "id": "5:2085921255424893696", + "name": "str1", + "type": 9 + }, + { + "id": "6:3046539664613253632", + "name": "str2", + "type": 9 + }, + { + "id": "7:4836319770403460352", + "name": "str3", + "type": 9 + }, + { + "id": "8:5586670376507097344", + "name": "str4", + "type": 9 + }, + { + "id": "9:8779305452755862528", + "name": "str5", + "type": 9 + }, + { + "id": "10:7042629853749457152", + "name": "str6", + "type": 9 + }, + { + "id": "11:439706265026898176", + "name": "str7", + "type": 9 + }, + { + "id": "12:7797853325787760640", + "name": "str8", + "type": 9 + }, + { + "id": "13:6241625149586299904", + "name": "str9", + "type": 9 + }, + { + "id": "14:3838386263292640000", + "name": "str10", + "type": 9 + }, + { + "id": "15:2743032249190027008", + "name": "str11", + "type": 9 + }, + { + "id": "16:6199657977327115264", + "name": "str12", + "type": 9 + }, + { + "id": "17:6070699861433961728", + "name": "str13", + "type": 9 + }, + { + "id": "18:6029297771178376192", + "name": "str14", + "type": 9 + }, + { + "id": "19:3801959474204611328", + "name": "str15", + "type": 9 + }, + { + "id": "20:4774675437756918784", + "name": "str16", + "type": 9 + }, + { + "id": "21:8716823039315984640", + "name": "str17", + "type": 9 + }, + { + "id": "22:8894733078890829312", + "name": "str18", + "type": 9 + }, + { + "id": "23:1016331229052728320", + "name": "str19", + "type": 9 + }, + { + "id": "24:7810872262587479552", + "name": "str20", + "type": 9 + }, + { + "id": "25:4945264553128454912", + "name": "str21", + "type": 9 + }, + { + "id": "26:7152265273971458560", + "name": "str22", + "type": 9 + }, + { + "id": "27:6294538152931964672", + "name": "str23", + "type": 9 + }, + { + "id": "28:1939674925644995328", + "name": "str24", + "type": 9 + }, + { + "id": "29:2630803146682539264", + "name": "str25", + "type": 9 + }, + { + "id": "30:2158082104313626880", + "name": "str26", + "type": 9 + }, + { + "id": "31:4342475978535002368", + "name": "str27", + "type": 9 + }, + { + "id": "32:2618142912991854080", + "name": "str28", + "type": 9 + }, + { + "id": "33:4257312550012133632", + "name": "str29", + "type": 9 + }, + { + "id": "34:6658936396910379008", + "name": "str30", + "type": 9 + }, + { + "id": "35:7163695098896884992", + "name": "str31", + "type": 9 + }, + { + "id": "36:7792683921785881088", + "name": "str32", + "type": 9 + }, + { + "id": "37:2422385911045001728", + "name": "str33", + "type": 9 + }, + { + "id": "38:672123555343571712", + "name": "str34", + "type": 9 + }, + { + "id": "39:3356171792266690304", + "name": "str35", + "type": 9 + }, + { + "id": "40:8097607156277667584", + "name": "str36", + "type": 9 + }, + { + "id": "41:5877691172915301888", + "name": "str37", + "type": 9 + }, + { + "id": "42:7464585023102901248", + "name": "str38", + "type": 9 + }, + { + "id": "43:8211367673094595840", + "name": "str39", + "type": 9 + }, + { + "id": "44:123610260452597504", + "name": "str40", + "type": 9 + }, + { + "id": "45:2650611557939850240", + "name": "str41", + "type": 9 + }, + { + "id": "46:8393105718552925184", + "name": "str42", + "type": 9 + }, + { + "id": "47:6619994367521497344", + "name": "str43", + "type": 9 + }, + { + "id": "48:4805478268913715712", + "name": "str44", + "type": 9 + }, + { + "id": "49:8642866290657149184", + "name": "str45", + "type": 9 + }, + { + "id": "50:5061363131252470016", + "name": "str46", + "type": 9 + }, + { + "id": "51:4113947004423223040", + "name": "str47", + "type": 9 + }, + { + "id": "52:9141471831020050944", + "name": "str48", + "type": 9 + }, + { + "id": "53:938475961386865664", + "name": "str49", + "type": 9 + }, + { + "id": "54:2610097445773727232", + "name": "str50", + "type": 9 + }, + { + "id": "55:8223075157327230976", + "name": "str51", + "type": 9 + }, + { + "id": "56:6658701894057099520", + "name": "str52", + "type": 9 + }, + { + "id": "57:4320563155554460672", + "name": "str53", + "type": 9 + }, + { + "id": "58:3648783095476185088", + "name": "str54", + "type": 9 + }, + { + "id": "59:7718378802309229824", + "name": "str55", + "type": 9 + }, + { + "id": "60:7657786762797563392", + "name": "str56", + "type": 9 + }, + { + "id": "61:729766303749804544", + "name": "str57", + "type": 9 + }, + { + "id": "62:8250473843241116672", + "name": "str58", + "type": 9 + }, + { + "id": "63:4473980843763389184", + "name": "str59", + "type": 9 + } + ], + "relations": [] + } + ], + "lastEntityId": "7:6258744021471265280", + "lastIndexId": "3:4943227758701996288", + "lastRelationId": "3:417604695477796352", + "lastSequenceId": "0:0", + "modelVersion": 5, + "modelVersionParserMinimum": 4, + "retiredEntityUids": [], + "retiredIndexUids": [], + "retiredPropertyUids": [], + "retiredRelationUids": [], + "version": 1 +} \ No newline at end of file diff --git a/Source/ios-framework/ObjectBox.xcodeproj/project.pbxproj b/Source/ios-framework/ObjectBox.xcodeproj/project.pbxproj index cf7ec94..7745254 100644 --- a/Source/ios-framework/ObjectBox.xcodeproj/project.pbxproj +++ b/Source/ios-framework/ObjectBox.xcodeproj/project.pbxproj @@ -46,15 +46,53 @@ 287B350025DE9D60004D312E /* SyncEnums.swift in Sources */ = {isa = PBXBuildFile; fileRef = 287B34FF25DE9D60004D312E /* SyncEnums.swift */; }; 287B350125DE9D60004D312E /* SyncEnums.swift in Sources */ = {isa = PBXBuildFile; fileRef = 287B34FF25DE9D60004D312E /* SyncEnums.swift */; }; 287B350225DE9D60004D312E /* SyncEnums.swift in Sources */ = {isa = PBXBuildFile; fileRef = 287B34FF25DE9D60004D312E /* SyncEnums.swift */; }; - 28A6B3DB247EEB1600C163B4 /* IntTestiOSRegular-Entities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A6B3D9247EEB1600C163B4 /* IntTestiOSRegular-Entities.swift */; }; - 28A6B3DC247EEB1600C163B4 /* IntTestiOSRegular-Entities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A6B3D9247EEB1600C163B4 /* IntTestiOSRegular-Entities.swift */; }; - 28A6B3DD247EEB1600C163B4 /* IntTestiOSRegular-EntityInfo-generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A6B3DA247EEB1600C163B4 /* IntTestiOSRegular-EntityInfo-generated.swift */; }; - 28A6B3DE247EEB1600C163B4 /* IntTestiOSRegular-EntityInfo-generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A6B3DA247EEB1600C163B4 /* IntTestiOSRegular-EntityInfo-generated.swift */; }; + 28A6B3DB247EEB1600C163B4 /* Entities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A6B3D9247EEB1600C163B4 /* Entities.swift */; }; + 28A6B3DC247EEB1600C163B4 /* Entities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A6B3D9247EEB1600C163B4 /* Entities.swift */; }; + 28A6B3DD247EEB1600C163B4 /* EntityInfo.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A6B3DA247EEB1600C163B4 /* EntityInfo.generated.swift */; }; + 28A6B3DE247EEB1600C163B4 /* EntityInfo.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A6B3DA247EEB1600C163B4 /* EntityInfo.generated.swift */; }; 28A6B3E0247EEB8700C163B4 /* ManyToManyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A6B3DF247EEB8700C163B4 /* ManyToManyTests.swift */; }; 28A6B3E1247EEB8700C163B4 /* ManyToManyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A6B3DF247EEB8700C163B4 /* ManyToManyTests.swift */; }; 28B4F2842600079D00B11EC4 /* objectbox-c-sync.h in Headers */ = {isa = PBXBuildFile; fileRef = 28B4F2832600079D00B11EC4 /* objectbox-c-sync.h */; settings = {ATTRIBUTES = (Public, ); }; }; 28B4F2852600079D00B11EC4 /* objectbox-c-sync.h in Headers */ = {isa = PBXBuildFile; fileRef = 28B4F2832600079D00B11EC4 /* objectbox-c-sync.h */; settings = {ATTRIBUTES = (Public, ); }; }; 28B4F2862600079D00B11EC4 /* objectbox-c-sync.h in Headers */ = {isa = PBXBuildFile; fileRef = 28B4F2832600079D00B11EC4 /* objectbox-c-sync.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 28DAD51F29784B76005EEF5D /* AppSyncTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 280E864524FA920B009B734D /* AppSyncTest.swift */; }; + 28DAD52029784B76005EEF5D /* EntityHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 280E864324FA7A8B009B734D /* EntityHelpers.swift */; }; + 28DAD52129784B76005EEF5D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 280E862924FA37EE009B734D /* AppDelegate.swift */; }; + 28DAD52229784B76005EEF5D /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 280E862B24FA37EE009B734D /* SceneDelegate.swift */; }; + 28DAD52329784B76005EEF5D /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 280E862D24FA37EE009B734D /* ContentView.swift */; }; + 28DAD52529784B76005EEF5D /* ObjectBox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7561E91125CA0CA6003FD439 /* ObjectBox.framework */; }; + 28DAD52729784B76005EEF5D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 280E863424FA37F2009B734D /* LaunchScreen.storyboard */; }; + 28DAD52829784B76005EEF5D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 280E863224FA37F2009B734D /* Preview Assets.xcassets */; }; + 28DAD52929784B76005EEF5D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 280E862F24FA37F2009B734D /* Assets.xcassets */; }; + 28DAD52B29784B76005EEF5D /* ObjectBox.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7561E91125CA0CA6003FD439 /* ObjectBox.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 28DAD53929784C20005EEF5D /* NullablePropertyEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5070A9CF217F4C3B002305F8 /* NullablePropertyEntity.swift */; }; + 28DAD53A29784C20005EEF5D /* EntityInfo.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A6B3DA247EEB1600C163B4 /* EntityInfo.generated.swift */; }; + 28DAD53B29784C20005EEF5D /* Entities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A6B3D9247EEB1600C163B4 /* Entities.swift */; }; + 28DAD53C29784C20005EEF5D /* TestExceptionProducer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5070A9DF217F4C3B002305F8 /* TestExceptionProducer.mm */; }; + 28DAD53D29784C20005EEF5D /* TestEntities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55D19CA82280601B00BEAD37 /* TestEntities.swift */; }; + 28DAD53E29784C20005EEF5D /* RelatedEntities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5070A9CD217F4C3B002305F8 /* RelatedEntities.swift */; }; + 28DAD53F29784C20005EEF5D /* AsyncTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C14CEB2307103D00F10D7D /* AsyncTest.swift */; }; + 28DAD54029784C20005EEF5D /* QueryOperatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5070A9CA217F4C3B002305F8 /* QueryOperatorTests.swift */; }; + 28DAD54129784C20005EEF5D /* BoxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5541762B2278584200B3A225 /* BoxTests.swift */; }; + 28DAD54229784C20005EEF5D /* ExceptionHelpers+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5070A9DD217F4C3B002305F8 /* ExceptionHelpers+Swift.swift */; }; + 28DAD54329784C20005EEF5D /* ErrorHelperIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5541762E2278726300B3A225 /* ErrorHelperIntegrationTests.swift */; }; + 28DAD54429784C20005EEF5D /* QueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5070A9D4217F4C3B002305F8 /* QueryTests.swift */; }; + 28DAD54529784C20005EEF5D /* TransactionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 554176252277575700B3A225 /* TransactionTests.swift */; }; + 28DAD54629784C20005EEF5D /* PropertyQueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5070A9D6217F4C3B002305F8 /* PropertyQueryTests.swift */; }; + 28DAD54729784C20005EEF5D /* StoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 554176282278445700B3A225 /* StoreTests.swift */; }; + 28DAD54829784C20005EEF5D /* CombineTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55FBE6C6230C4D2A00F41F88 /* CombineTests.swift */; }; + 28DAD54929784C20005EEF5D /* QueryBuilderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 554176182272101500B3A225 /* QueryBuilderTests.swift */; }; + 28DAD54A29784C20005EEF5D /* SwiftRefinedAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5070A9C9217F4C3B002305F8 /* SwiftRefinedAPITests.swift */; }; + 28DAD54B29784C20005EEF5D /* Entity+NullablePropertyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5070A9D5217F4C3B002305F8 /* Entity+NullablePropertyTests.swift */; }; + 28DAD54C29784C20005EEF5D /* ExceptionHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 5070A9DC217F4C3B002305F8 /* ExceptionHelpers.m */; }; + 28DAD54D29784C20005EEF5D /* StructEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 558A78FF2281B65A00BAE9C9 /* StructEntity.swift */; }; + 28DAD54E29784C20005EEF5D /* PureSwiftEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5070A9D2217F4C3B002305F8 /* PureSwiftEntity.swift */; }; + 28DAD54F29784C20005EEF5D /* ManyToManyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A6B3DF247EEB8700C163B4 /* ManyToManyTests.swift */; }; + 28DAD55029784C20005EEF5D /* ToOneRelationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5070A9D9217F4C3B002305F8 /* ToOneRelationTests.swift */; }; + 28DAD55129784C20005EEF5D /* SyncDryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF8C95A6D4560D27C44FAAF3 /* SyncDryTests.swift */; }; + 28DAD55229784C20005EEF5D /* ToManyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF8C96EC25D5705F5CA2FD3C /* ToManyTests.swift */; }; + 28DAD55329784C20005EEF5D /* UtilTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF8C9F2FECFA173905FD4726 /* UtilTests.swift */; }; + 28DAD55629784C20005EEF5D /* ObjectBox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7561E91125CA0CA6003FD439 /* ObjectBox.framework */; }; 503962EB216363A1000DFB7E /* ToMany.swift in Sources */ = {isa = PBXBuildFile; fileRef = 503962EA216363A1000DFB7E /* ToMany.swift */; }; 506858CF211B1864003F7D02 /* QueryConditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 506858CE211B1864003F7D02 /* QueryConditions.swift */; }; 506B0938215377410016C7AA /* ToOne.swift in Sources */ = {isa = PBXBuildFile; fileRef = 506B0937215377410016C7AA /* ToOne.swift */; }; @@ -276,41 +314,62 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 5070AB0D21808086002305F8 /* PBXContainerItemProxy */ = { + 28DAD53129784B97005EEF5D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = CB3B3F2820AB4B4B00418618 /* Project object */; proxyType = 1; remoteGlobalIDString = 5070A964217F479C002305F8; remoteInfo = "ObjectBox-iOS"; }; - 50C365B220BE8FC200F77FA3 /* PBXContainerItemProxy */ = { + 28DAD53529784C20005EEF5D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = CB3B3F2820AB4B4B00418618 /* Project object */; proxyType = 1; - remoteGlobalIDString = CB3B3F3020AB4B4B00418618; - remoteInfo = "ObjectBox-macOS"; + remoteGlobalIDString = 7561E8CE25CA0CA6003FD439; + remoteInfo = "ObjectBox-iOS Simulator"; }; - 55C37BD321BFC1770012BC0D /* PBXContainerItemProxy */ = { + 28DAD53729784C20005EEF5D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = CB3B3F2820AB4B4B00418618 /* Project object */; proxyType = 1; - remoteGlobalIDString = CB3B3F3020AB4B4B00418618; - remoteInfo = "ObjectBox-macOS"; + remoteGlobalIDString = 280E862624FA37EE009B734D; + remoteInfo = ObjectBoxiOSTestApp; }; - 7518E47925FBE7B700B73E74 /* PBXContainerItemProxy */ = { + 28DAD55D29784C50005EEF5D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = CB3B3F2820AB4B4B00418618 /* Project object */; proxyType = 1; - remoteGlobalIDString = 7561E8CE25CA0CA6003FD439; - remoteInfo = "ObjectBox-iOS Simulator"; + remoteGlobalIDString = 5070A964217F479C002305F8; + remoteInfo = "ObjectBox-iOS"; }; - 7518E48B25FBE81000B73E74 /* PBXContainerItemProxy */ = { + 28DAD55F29784C55005EEF5D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = CB3B3F2820AB4B4B00418618 /* Project object */; proxyType = 1; - remoteGlobalIDString = 280E862624FA37EE009B734D; + remoteGlobalIDString = 28DAD51B29784B76005EEF5D; remoteInfo = ObjectBoxiOSTestApp; }; + 5070AB0D21808086002305F8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = CB3B3F2820AB4B4B00418618 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5070A964217F479C002305F8; + remoteInfo = "ObjectBox-iOS"; + }; + 50C365B220BE8FC200F77FA3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = CB3B3F2820AB4B4B00418618 /* Project object */; + proxyType = 1; + remoteGlobalIDString = CB3B3F3020AB4B4B00418618; + remoteInfo = "ObjectBox-macOS"; + }; + 55C37BD321BFC1770012BC0D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = CB3B3F2820AB4B4B00418618 /* Project object */; + proxyType = 1; + remoteGlobalIDString = CB3B3F3020AB4B4B00418618; + remoteInfo = "ObjectBox-macOS"; + }; 7518E4E225FBEA7700B73E74 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = CB3B3F2820AB4B4B00418618 /* Project object */; @@ -321,6 +380,17 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ + 28DAD52A29784B76005EEF5D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 28DAD52B29784B76005EEF5D /* ObjectBox.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; 50D7EF8020EC9E470001872D /* Copy Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -345,7 +415,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 280E862724FA37EE009B734D /* ObjectBoxiOSTestApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ObjectBoxiOSTestApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 280E862724FA37EE009B734D /* ObjectBoxiOSTestApp Simulator.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ObjectBoxiOSTestApp Simulator.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 280E862924FA37EE009B734D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 280E862B24FA37EE009B734D /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 280E862D24FA37EE009B734D /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -360,10 +430,14 @@ 283C8EC625C0A1ED001ABC37 /* libObjectBoxCore-iOS.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libObjectBoxCore-iOS.a"; path = "../external/objectbox-static/libObjectBoxCore-iOS.a"; sourceTree = ""; }; 283C8ED025C0A2B3001ABC37 /* libObjectBoxCore-iOS.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libObjectBoxCore-iOS.a"; path = "../../external/objectbox-static/libObjectBoxCore-iOS.a"; sourceTree = ""; }; 287B34FF25DE9D60004D312E /* SyncEnums.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SyncEnums.swift; sourceTree = ""; }; - 28A6B3D9247EEB1600C163B4 /* IntTestiOSRegular-Entities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "IntTestiOSRegular-Entities.swift"; sourceTree = ""; }; - 28A6B3DA247EEB1600C163B4 /* IntTestiOSRegular-EntityInfo-generated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "IntTestiOSRegular-EntityInfo-generated.swift"; sourceTree = ""; }; + 28A6B3D9247EEB1600C163B4 /* Entities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Entities.swift; sourceTree = ""; }; + 28A6B3DA247EEB1600C163B4 /* EntityInfo.generated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EntityInfo.generated.swift; sourceTree = ""; }; 28A6B3DF247EEB8700C163B4 /* ManyToManyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManyToManyTests.swift; sourceTree = ""; }; 28B4F2832600079D00B11EC4 /* objectbox-c-sync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "objectbox-c-sync.h"; sourceTree = ""; }; + 28DAD52F29784B76005EEF5D /* ObjectBoxiOSTestApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ObjectBoxiOSTestApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 28DAD53029784B78005EEF5D /* ObjectBoxiOSTestApp copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = file.bak; name = "ObjectBoxiOSTestApp copy-Info.plist"; path = "/Users/markus/dev/objectbox-swift/ios-framework/ObjectBoxiOSTestApp copy-Info.plist"; sourceTree = ""; }; + 28DAD55B29784C20005EEF5D /* ObjectBoxTests-iOS Simulator.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ObjectBoxTests-iOS Simulator.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 28DAD55C29784C22005EEF5D /* ObjectBoxTests-iOS copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = file.bak; name = "ObjectBoxTests-iOS copy-Info.plist"; path = "/Users/markus/dev/objectbox-swift/ios-framework/ObjectBoxTests-iOS copy-Info.plist"; sourceTree = ""; }; 28E90AED25C1DE5E008C55BC /* libObjectBoxCore-iOS-sim.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libObjectBoxCore-iOS-sim.a"; path = "../../external/objectbox-static/libObjectBoxCore-iOS-sim.a"; sourceTree = ""; }; 503962EA216363A1000DFB7E /* ToMany.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToMany.swift; sourceTree = ""; }; 5042FDB220CBE18600EBCA52 /* ObjectBoxTests-macOS-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ObjectBoxTests-macOS-Bridging-Header.h"; sourceTree = ""; }; @@ -474,6 +548,22 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 28DAD52429784B76005EEF5D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 28DAD52529784B76005EEF5D /* ObjectBox.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 28DAD55529784C20005EEF5D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 28DAD55629784C20005EEF5D /* ObjectBox.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5070A962217F479C002305F8 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -667,8 +757,8 @@ 5070A9CC217F4C3B002305F8 /* Test Entities */ = { isa = PBXGroup; children = ( - 28A6B3D9247EEB1600C163B4 /* IntTestiOSRegular-Entities.swift */, - 28A6B3DA247EEB1600C163B4 /* IntTestiOSRegular-EntityInfo-generated.swift */, + 28A6B3D9247EEB1600C163B4 /* Entities.swift */, + 28A6B3DA247EEB1600C163B4 /* EntityInfo.generated.swift */, 5070A9CF217F4C3B002305F8 /* NullablePropertyEntity.swift */, 5070A9D2217F4C3B002305F8 /* PureSwiftEntity.swift */, 5070A9CD217F4C3B002305F8 /* RelatedEntities.swift */, @@ -800,6 +890,8 @@ 5042FDC620CEA3C500EBCA52 /* Frameworks */, CB3B3F3220AB4B4B00418618 /* Products */, 287B34BC25DD2369004D312E /* Recovered References */, + 28DAD53029784B78005EEF5D /* ObjectBoxiOSTestApp copy-Info.plist */, + 28DAD55C29784C22005EEF5D /* ObjectBoxTests-iOS copy-Info.plist */, ); sourceTree = ""; }; @@ -811,8 +903,10 @@ 5070A965217F479C002305F8 /* ObjectBox.framework */, 5070A96D217F479C002305F8 /* ObjectBoxTests-iOS.xctest */, 55D3E5B52375AB3B002F286D /* OBXCodeGen.framework */, - 280E862724FA37EE009B734D /* ObjectBoxiOSTestApp.app */, + 280E862724FA37EE009B734D /* ObjectBoxiOSTestApp Simulator.app */, 7561E91125CA0CA6003FD439 /* ObjectBox.framework */, + 28DAD52F29784B76005EEF5D /* ObjectBoxiOSTestApp.app */, + 28DAD55B29784C20005EEF5D /* ObjectBoxTests-iOS Simulator.xctest */, ); name = Products; sourceTree = ""; @@ -881,9 +975,9 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 280E862624FA37EE009B734D /* ObjectBoxiOSTestApp */ = { + 280E862624FA37EE009B734D /* ObjectBoxiOSTestApp Simulator */ = { isa = PBXNativeTarget; - buildConfigurationList = 280E863A24FA37F2009B734D /* Build configuration list for PBXNativeTarget "ObjectBoxiOSTestApp" */; + buildConfigurationList = 280E863A24FA37F2009B734D /* Build configuration list for PBXNativeTarget "ObjectBoxiOSTestApp Simulator" */; buildPhases = ( 280E862324FA37EE009B734D /* Sources */, 280E862424FA37EE009B734D /* Frameworks */, @@ -895,11 +989,49 @@ dependencies = ( 7518E4E325FBEA7700B73E74 /* PBXTargetDependency */, ); + name = "ObjectBoxiOSTestApp Simulator"; + productName = ObjectBoxiOSTestApp; + productReference = 280E862724FA37EE009B734D /* ObjectBoxiOSTestApp Simulator.app */; + productType = "com.apple.product-type.application"; + }; + 28DAD51B29784B76005EEF5D /* ObjectBoxiOSTestApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 28DAD52C29784B76005EEF5D /* Build configuration list for PBXNativeTarget "ObjectBoxiOSTestApp" */; + buildPhases = ( + 28DAD51E29784B76005EEF5D /* Sources */, + 28DAD52429784B76005EEF5D /* Frameworks */, + 28DAD52629784B76005EEF5D /* Resources */, + 28DAD52A29784B76005EEF5D /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 28DAD53229784B97005EEF5D /* PBXTargetDependency */, + ); name = ObjectBoxiOSTestApp; productName = ObjectBoxiOSTestApp; - productReference = 280E862724FA37EE009B734D /* ObjectBoxiOSTestApp.app */; + productReference = 28DAD52F29784B76005EEF5D /* ObjectBoxiOSTestApp.app */; productType = "com.apple.product-type.application"; }; + 28DAD53329784C20005EEF5D /* ObjectBoxTests-iOS Simulator */ = { + isa = PBXNativeTarget; + buildConfigurationList = 28DAD55829784C20005EEF5D /* Build configuration list for PBXNativeTarget "ObjectBoxTests-iOS Simulator" */; + buildPhases = ( + 28DAD53829784C20005EEF5D /* Sources */, + 28DAD55529784C20005EEF5D /* Frameworks */, + 28DAD55729784C20005EEF5D /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 28DAD53429784C20005EEF5D /* PBXTargetDependency */, + 28DAD53629784C20005EEF5D /* PBXTargetDependency */, + ); + name = "ObjectBoxTests-iOS Simulator"; + productName = "ObjectBox-iOSTests"; + productReference = 28DAD55B29784C20005EEF5D /* ObjectBoxTests-iOS Simulator.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 5070A964217F479C002305F8 /* ObjectBox-iOS */ = { isa = PBXNativeTarget; buildConfigurationList = 5070A97B217F479C002305F8 /* Build configuration list for PBXNativeTarget "ObjectBox-iOS" */; @@ -930,8 +1062,8 @@ buildRules = ( ); dependencies = ( - 7518E47A25FBE7B700B73E74 /* PBXTargetDependency */, - 7518E48C25FBE81000B73E74 /* PBXTargetDependency */, + 28DAD55E29784C50005EEF5D /* PBXTargetDependency */, + 28DAD56029784C55005EEF5D /* PBXTargetDependency */, ); name = "ObjectBoxTests-iOS"; productName = "ObjectBox-iOSTests"; @@ -1070,14 +1202,16 @@ projectRoot = ""; targets = ( CB3B3F3020AB4B4B00418618 /* ObjectBox-macOS */, - 50C365AB20BE8FC200F77FA3 /* ObjectBoxTests-macOS */, 5070A964217F479C002305F8 /* ObjectBox-iOS */, 7561E8CE25CA0CA6003FD439 /* ObjectBox-iOS Simulator */, + 50C365AB20BE8FC200F77FA3 /* ObjectBoxTests-macOS */, 5070A96C217F479C002305F8 /* ObjectBoxTests-iOS */, + 28DAD53329784C20005EEF5D /* ObjectBoxTests-iOS Simulator */, 5070AB072180807E002305F8 /* iOS-Fat-Framework */, 55C37BCD21BFC1610012BC0D /* CodeGenTests */, 55D3E5B42375AB3B002F286D /* OBXCodeGen */, - 280E862624FA37EE009B734D /* ObjectBoxiOSTestApp */, + 28DAD51B29784B76005EEF5D /* ObjectBoxiOSTestApp */, + 280E862624FA37EE009B734D /* ObjectBoxiOSTestApp Simulator */, ); }; /* End PBXProject section */ @@ -1093,6 +1227,23 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 28DAD52629784B76005EEF5D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 28DAD52729784B76005EEF5D /* LaunchScreen.storyboard in Resources */, + 28DAD52829784B76005EEF5D /* Preview Assets.xcassets in Resources */, + 28DAD52929784B76005EEF5D /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 28DAD55729784C20005EEF5D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5070A963217F479C002305F8 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1262,6 +1413,52 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 28DAD51E29784B76005EEF5D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 28DAD51F29784B76005EEF5D /* AppSyncTest.swift in Sources */, + 28DAD52029784B76005EEF5D /* EntityHelpers.swift in Sources */, + 28DAD52129784B76005EEF5D /* AppDelegate.swift in Sources */, + 28DAD52229784B76005EEF5D /* SceneDelegate.swift in Sources */, + 28DAD52329784B76005EEF5D /* ContentView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 28DAD53829784C20005EEF5D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 28DAD53929784C20005EEF5D /* NullablePropertyEntity.swift in Sources */, + 28DAD53A29784C20005EEF5D /* EntityInfo.generated.swift in Sources */, + 28DAD53B29784C20005EEF5D /* Entities.swift in Sources */, + 28DAD53C29784C20005EEF5D /* TestExceptionProducer.mm in Sources */, + 28DAD53D29784C20005EEF5D /* TestEntities.swift in Sources */, + 28DAD53E29784C20005EEF5D /* RelatedEntities.swift in Sources */, + 28DAD53F29784C20005EEF5D /* AsyncTest.swift in Sources */, + 28DAD54029784C20005EEF5D /* QueryOperatorTests.swift in Sources */, + 28DAD54129784C20005EEF5D /* BoxTests.swift in Sources */, + 28DAD54229784C20005EEF5D /* ExceptionHelpers+Swift.swift in Sources */, + 28DAD54329784C20005EEF5D /* ErrorHelperIntegrationTests.swift in Sources */, + 28DAD54429784C20005EEF5D /* QueryTests.swift in Sources */, + 28DAD54529784C20005EEF5D /* TransactionTests.swift in Sources */, + 28DAD54629784C20005EEF5D /* PropertyQueryTests.swift in Sources */, + 28DAD54729784C20005EEF5D /* StoreTests.swift in Sources */, + 28DAD54829784C20005EEF5D /* CombineTests.swift in Sources */, + 28DAD54929784C20005EEF5D /* QueryBuilderTests.swift in Sources */, + 28DAD54A29784C20005EEF5D /* SwiftRefinedAPITests.swift in Sources */, + 28DAD54B29784C20005EEF5D /* Entity+NullablePropertyTests.swift in Sources */, + 28DAD54C29784C20005EEF5D /* ExceptionHelpers.m in Sources */, + 28DAD54D29784C20005EEF5D /* StructEntity.swift in Sources */, + 28DAD54E29784C20005EEF5D /* PureSwiftEntity.swift in Sources */, + 28DAD54F29784C20005EEF5D /* ManyToManyTests.swift in Sources */, + 28DAD55029784C20005EEF5D /* ToOneRelationTests.swift in Sources */, + 28DAD55129784C20005EEF5D /* SyncDryTests.swift in Sources */, + 28DAD55229784C20005EEF5D /* ToManyTests.swift in Sources */, + 28DAD55329784C20005EEF5D /* UtilTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5070A961217F479C002305F8 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1323,8 +1520,8 @@ buildActionMask = 2147483647; files = ( 5070AA00217F4CF7002305F8 /* NullablePropertyEntity.swift in Sources */, - 28A6B3DE247EEB1600C163B4 /* IntTestiOSRegular-EntityInfo-generated.swift in Sources */, - 28A6B3DC247EEB1600C163B4 /* IntTestiOSRegular-Entities.swift in Sources */, + 28A6B3DE247EEB1600C163B4 /* EntityInfo.generated.swift in Sources */, + 28A6B3DC247EEB1600C163B4 /* Entities.swift in Sources */, 5070A9FA217F4CA8002305F8 /* TestExceptionProducer.mm in Sources */, 55D19CAC2280632E00BEAD37 /* TestEntities.swift in Sources */, 5070AA02217F4CF7002305F8 /* RelatedEntities.swift in Sources */, @@ -1357,8 +1554,8 @@ buildActionMask = 2147483647; files = ( 5070AA0E217F4EC7002305F8 /* NullablePropertyEntity.swift in Sources */, - 28A6B3DD247EEB1600C163B4 /* IntTestiOSRegular-EntityInfo-generated.swift in Sources */, - 28A6B3DB247EEB1600C163B4 /* IntTestiOSRegular-Entities.swift in Sources */, + 28A6B3DD247EEB1600C163B4 /* EntityInfo.generated.swift in Sources */, + 28A6B3DB247EEB1600C163B4 /* Entities.swift in Sources */, 5070AA0A217F4EC4002305F8 /* QueryOperatorTests.swift in Sources */, 55D19CAB2280632D00BEAD37 /* TestEntities.swift in Sources */, 5070AA0D217F4EC4002305F8 /* ToOneRelationTests.swift in Sources */, @@ -1509,6 +1706,31 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 28DAD53229784B97005EEF5D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5070A964217F479C002305F8 /* ObjectBox-iOS */; + targetProxy = 28DAD53129784B97005EEF5D /* PBXContainerItemProxy */; + }; + 28DAD53429784C20005EEF5D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7561E8CE25CA0CA6003FD439 /* ObjectBox-iOS Simulator */; + targetProxy = 28DAD53529784C20005EEF5D /* PBXContainerItemProxy */; + }; + 28DAD53629784C20005EEF5D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 280E862624FA37EE009B734D /* ObjectBoxiOSTestApp Simulator */; + targetProxy = 28DAD53729784C20005EEF5D /* PBXContainerItemProxy */; + }; + 28DAD55E29784C50005EEF5D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5070A964217F479C002305F8 /* ObjectBox-iOS */; + targetProxy = 28DAD55D29784C50005EEF5D /* PBXContainerItemProxy */; + }; + 28DAD56029784C55005EEF5D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 28DAD51B29784B76005EEF5D /* ObjectBoxiOSTestApp */; + targetProxy = 28DAD55F29784C55005EEF5D /* PBXContainerItemProxy */; + }; 5070AB0E21808086002305F8 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 5070A964217F479C002305F8 /* ObjectBox-iOS */; @@ -1524,16 +1746,6 @@ target = CB3B3F3020AB4B4B00418618 /* ObjectBox-macOS */; targetProxy = 55C37BD321BFC1770012BC0D /* PBXContainerItemProxy */; }; - 7518E47A25FBE7B700B73E74 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 7561E8CE25CA0CA6003FD439 /* ObjectBox-iOS Simulator */; - targetProxy = 7518E47925FBE7B700B73E74 /* PBXContainerItemProxy */; - }; - 7518E48C25FBE81000B73E74 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 280E862624FA37EE009B734D /* ObjectBoxiOSTestApp */; - targetProxy = 7518E48B25FBE81000B73E74 /* PBXContainerItemProxy */; - }; 7518E4E325FBEA7700B73E74 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 7561E8CE25CA0CA6003FD439 /* ObjectBox-iOS Simulator */; @@ -1561,7 +1773,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_ASSET_PATHS = "\"ObjectBoxiOSTestApp/Preview Content\""; DEVELOPMENT_TEAM = 4JF56U4GJ2; - ENABLE_BITCODE = YES; + ENABLE_BITCODE = NO; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = ObjectBoxiOSTestApp/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -1590,7 +1802,7 @@ COPY_PHASE_STRIP = NO; DEVELOPMENT_ASSET_PATHS = "\"ObjectBoxiOSTestApp/Preview Content\""; DEVELOPMENT_TEAM = 4JF56U4GJ2; - ENABLE_BITCODE = YES; + ENABLE_BITCODE = NO; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = ObjectBoxiOSTestApp/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -1609,6 +1821,129 @@ }; name = Release; }; + 28DAD52D29784B76005EEF5D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"ObjectBoxiOSTestApp/Preview Content\""; + DEVELOPMENT_TEAM = 4JF56U4GJ2; + ENABLE_BITCODE = NO; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = "ObjectBoxiOSTestApp copy-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.objectbox.ObjectBoxiOSTestApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 28DAD52E29784B76005EEF5D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + COPY_PHASE_STRIP = NO; + DEVELOPMENT_ASSET_PATHS = "\"ObjectBoxiOSTestApp/Preview Content\""; + DEVELOPMENT_TEAM = 4JF56U4GJ2; + ENABLE_BITCODE = NO; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = "ObjectBoxiOSTestApp copy-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.objectbox.ObjectBoxiOSTestApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 28DAD55929784C20005EEF5D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 4JF56U4GJ2; + INFOPLIST_FILE = "ObjectBoxTests-iOS copy-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + OTHER_LDFLAGS = ( + "-weak_framework", + Combine, + ); + PRODUCT_BUNDLE_IDENTIFIER = "io.objectbox.ObjectBoxTests-iOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SUPPORTS_MACCATALYST = NO; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OBJC_BRIDGING_HEADER = "ObjectBoxTests-iOS/ObjectBoxTests-iOS-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ObjectBoxiOSTestApp.app/ObjectBoxiOSTestApp"; + }; + name = Debug; + }; + 28DAD55A29784C20005EEF5D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 4JF56U4GJ2; + INFOPLIST_FILE = "ObjectBoxTests-iOS copy-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MTL_FAST_MATH = YES; + OTHER_LDFLAGS = ( + "-weak_framework", + Combine, + ); + PRODUCT_BUNDLE_IDENTIFIER = "io.objectbox.ObjectBoxTests-iOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SUPPORTS_MACCATALYST = NO; + SWIFT_OBJC_BRIDGING_HEADER = "ObjectBoxTests-iOS/ObjectBoxTests-iOS-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ObjectBoxiOSTestApp.app/ObjectBoxiOSTestApp"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; 5070A976217F479C002305F8 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1701,7 +2036,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 4JF56U4GJ2; INFOPLIST_FILE = "ObjectBoxTests-iOS/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = ( @@ -1735,7 +2070,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 4JF56U4GJ2; INFOPLIST_FILE = "ObjectBoxTests-iOS/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = ( @@ -2230,7 +2565,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 280E863A24FA37F2009B734D /* Build configuration list for PBXNativeTarget "ObjectBoxiOSTestApp" */ = { + 280E863A24FA37F2009B734D /* Build configuration list for PBXNativeTarget "ObjectBoxiOSTestApp Simulator" */ = { isa = XCConfigurationList; buildConfigurations = ( 280E863824FA37F2009B734D /* Debug */, @@ -2239,6 +2574,24 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 28DAD52C29784B76005EEF5D /* Build configuration list for PBXNativeTarget "ObjectBoxiOSTestApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 28DAD52D29784B76005EEF5D /* Debug */, + 28DAD52E29784B76005EEF5D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 28DAD55829784C20005EEF5D /* Build configuration list for PBXNativeTarget "ObjectBoxTests-iOS Simulator" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 28DAD55929784C20005EEF5D /* Debug */, + 28DAD55A29784C20005EEF5D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 5070A97B217F479C002305F8 /* Build configuration list for PBXNativeTarget "ObjectBox-iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Source/ios-framework/README.md b/Source/ios-framework/README.md index ef738a5..93263c8 100644 --- a/Source/ios-framework/README.md +++ b/Source/ios-framework/README.md @@ -9,7 +9,7 @@ This is the ObjectBox Swift **API reference**. Also check the **[guides](https://swift.objectbox.io/)** for general documentation including [setup](https://swift.objectbox.io/install) and [getting started](https://swift.objectbox.io/getting-started). -Current version: 1.8.0 +Current version: 1.8.1 ## Most Important Types