Skip to content

Commit 2df94a0

Browse files
ObjectBox Swift database 5.1.0
1 parent 025cdbd commit 2df94a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1664
-594
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Notable changes to the ObjectBox Swift library.
44

55
For more insights into what changed in the ObjectBox C++ core, [check the ObjectBox C changelog](https://github.com/objectbox/objectbox-c/blob/main/CHANGELOG.md).
66

7-
## Next release
7+
## 5.1.0 - 2025-12-03
88

99
Note: To support Xcode 26 and new Swift versions, the requirements have been raised to macOS 11.0 or iOS 15.0 and Swift 6.1 tools.
1010

Example/NotesExample.xcodeproj/project.pbxproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,8 @@
436436
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
437437
GCC_WARN_UNUSED_FUNCTION = YES;
438438
GCC_WARN_UNUSED_VARIABLE = YES;
439-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
440-
MACOSX_DEPLOYMENT_TARGET = 10.15;
439+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
440+
MACOSX_DEPLOYMENT_TARGET = 11.0;
441441
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
442442
MTL_FAST_MATH = YES;
443443
ONLY_ACTIVE_ARCH = YES;
@@ -494,8 +494,8 @@
494494
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
495495
GCC_WARN_UNUSED_FUNCTION = YES;
496496
GCC_WARN_UNUSED_VARIABLE = YES;
497-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
498-
MACOSX_DEPLOYMENT_TARGET = 10.15;
497+
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
498+
MACOSX_DEPLOYMENT_TARGET = 11.0;
499499
MTL_ENABLE_DEBUG_INFO = NO;
500500
MTL_FAST_MATH = YES;
501501
SDKROOT = iphoneos;
@@ -581,7 +581,7 @@
581581
repositoryURL = "https://github.com/objectbox/objectbox-swift-spm";
582582
requirement = {
583583
kind = upToNextMajorVersion;
584-
minimumVersion = 5.0.0;
584+
minimumVersion = 5.1.0;
585585
};
586586
};
587587
/* End XCRemoteSwiftPackageReference section */

Source/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ make u_tests
7575
# Build a debug version of the generator
7676
make build_generator_debug
7777
# Run generator tests
78-
make g_tests_run
78+
make g_tests
7979
```
8080

8181
**To run a specific unit test** change the last argument to specify your test. You can also run a group/class by removing the last one/two parts of the filter.

Source/fetch_dependencies.command

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ set -e
1313

1414
# objectbox-swift release version on GitHub:
1515
# https://github.com/objectbox/objectbox-swift/releases/download/v${version}
16-
version=5.0.0
16+
version=5.1.0
1717

1818
# C library version attached to the GitHub release:
1919
# ObjectBoxCore-static-${c_version}.zip
20-
c_version=5.0.0
20+
c_version=5.1.0
2121

2222
# Params supported by apple-build-static-libs.sh
2323
if [ -n "$OBX_SKIP_STATIC_C_TESTS" ]; then
@@ -127,10 +127,6 @@ if [ -d "$code_dir" ] && [ "$staging_repo" != "true" ]; then # Do we have an exi
127127
fi
128128

129129
# Build
130-
# Temporary: ld warns that static library is not built for 10.15 (but macOS.cmake sets CMAKE_OSX_DEPLOYMENT_TARGET),
131-
# to resolve set MACOSX_DEPLOYMENT_TARGET here until core build scripts are updated.
132-
# Internal issue: objectbox/objectbox-swift#274
133-
export MACOSX_DEPLOYMENT_TARGET="10.15"
134130
"$code_dir/scripts/apple-build-static-libs.sh" $build_params "$dest_dir" release
135131

136132
if [ "$git_clean" = true ] ; then # clean before?

Source/ios-framework/CodeGenTests/RunToolTests.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,16 @@ test_target_num () {
145145
fi
146146

147147
if [ $FAIL -eq 0 ]; then
148-
xcodebuild FRAMEWORK_SEARCH_PATHS="${BUILT_PRODUCTS_DIR}" -quiet -project "$TESTPROJECT" -target "ToolTestProject${2}" CONFIGURATION_BUILD_DIR="${BUILT_PRODUCTS_DIR}"
148+
echo "Running xcodebuild with ARCHS=$ARCHS ONLY_ACTIVE_ARCH=$ONLY_ACTIVE_ARCH"
149+
xcodebuild \
150+
FRAMEWORK_SEARCH_PATHS="${BUILT_PRODUCTS_DIR}" \
151+
-quiet \
152+
-project "$TESTPROJECT" \
153+
-target "ToolTestProject${2}" \
154+
CONFIGURATION_BUILD_DIR="${BUILT_PRODUCTS_DIR}" \
155+
ARCHS=$ARCHS \
156+
ONLY_ACTIVE_ARCH=$ONLY_ACTIVE_ARCH
157+
149158
if [ $? -eq 0 ]; then
150159
echo "note: $2: $1: Built test target."
151160
else
@@ -268,8 +277,17 @@ fail_codegen_target_num () {
268277

269278
if [ $FAIL -eq 0 ]; then
270279
if [ -e "$ORIGINALXCODELOGFILE" ]; then
271-
xcodebuild FRAMEWORK_SEARCH_PATHS="${BUILT_PRODUCTS_DIR}" -quiet -project "$TESTPROJECT" -target "ToolTestProject${2}" CONFIGURATION_BUILD_DIR="${BUILT_PRODUCTS_DIR}" > "$TESTXCODELOGFILE"
272-
280+
echo "Running xcodebuild with ARCHS=$ARCHS ONLY_ACTIVE_ARCH=$ONLY_ACTIVE_ARCH"
281+
xcodebuild \
282+
FRAMEWORK_SEARCH_PATHS="${BUILT_PRODUCTS_DIR}" \
283+
-quiet \
284+
-project "$TESTPROJECT" \
285+
-target "ToolTestProject${2}" \
286+
CONFIGURATION_BUILD_DIR="${BUILT_PRODUCTS_DIR}" \
287+
ARCHS=$ARCHS \
288+
ONLY_ACTIVE_ARCH=$ONLY_ACTIVE_ARCH \
289+
> "$TESTXCODELOGFILE"
290+
273291
OLDPWD="`pwd`"
274292
cd "$MYDIR"
275293
GITROOT=`git rev-parse --show-toplevel`

Source/ios-framework/CodeGenTests/ToolTestProject25.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright © 2018-2024 ObjectBox Ltd. All rights reserved.
2+
// Copyright © 2018-2025 ObjectBox Ltd. <https://objectbox.io>
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -48,8 +48,11 @@ class TypeTest: Entity {
4848
var doubleValue: Double = -15301.06221
4949
var dateValue: Date = Date(timeIntervalSinceReferenceDate: 900.75)
5050

51-
var floatArray: [Float] = []
52-
51+
var int32Array: [Int32] = []
52+
var int64Array: [Int64] = []
53+
var floatArray: [Float] = [2.3, 4.5, 6.7, 8.9]
54+
var stringArray: [String] = ["Hello", "World"]
55+
5356
required init() {}
5457
}
5558

@@ -154,6 +157,12 @@ func main(_ args: [String]) throws -> Int32 {
154157
if ((originalTypeTest.dateValue.timeIntervalSinceReferenceDate - readTypeTest.dateValue.timeIntervalSinceReferenceDate) > 0.001) {
155158
throw Error.ValueReadDoesntEqualValueWritten(property: "date", written: originalTypeTest.dateValue, read: readTypeTest.dateValue)
156159
}
160+
if (originalTypeTest.floatArray != readTypeTest.floatArray) {
161+
throw Error.ValueReadDoesntEqualValueWritten(property: "floatArray", written: originalTypeTest.floatArray, read: readTypeTest.floatArray)
162+
}
163+
if (originalTypeTest.stringArray != readTypeTest.stringArray) {
164+
throw Error.ValueReadDoesntEqualValueWritten(property: "stringArray", written: originalTypeTest.stringArray, read: readTypeTest.stringArray)
165+
}
157166
} else {
158167
throw Error.FailedToReadEntity
159168
}

Source/ios-framework/CodeGenTests/expected/entity-info/EntityInfo.generated25.swift

Lines changed: 63 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ extension TypeTest: ObjectBox.EntityInspectable {
213213
internal static let entityBinding = EntityBindingType()
214214

215215
fileprivate static func buildEntity(modelBuilder: ObjectBox.ModelBuilder) throws {
216-
let entityBuilder = try modelBuilder.entityBuilder(for: TypeTest.self, id: 2, uid: 42496)
216+
let entityBuilder = try modelBuilder.entityBuilder(for: TypeTest.self, id: 2, uid: 45568)
217217
try entityBuilder.addProperty(name: "id", type: PropertyType.long, flags: [.id], id: 1, uid: 22528)
218218
try entityBuilder.addProperty(name: "intValue", type: PropertyType.long, id: 2, uid: 23552)
219219
try entityBuilder.addProperty(name: "int8Value", type: PropertyType.byte, id: 3, uid: 24576)
@@ -233,9 +233,12 @@ extension TypeTest: ObjectBox.EntityInspectable {
233233
try entityBuilder.addProperty(name: "floatValue", type: PropertyType.float, id: 17, uid: 38656)
234234
try entityBuilder.addProperty(name: "doubleValue", type: PropertyType.double, id: 18, uid: 39680)
235235
try entityBuilder.addProperty(name: "dateValue", type: PropertyType.date, id: 19, uid: 40704)
236-
try entityBuilder.addProperty(name: "floatArray", type: PropertyType.floatVector, id: 20, uid: 41728)
236+
try entityBuilder.addProperty(name: "int32Array", type: PropertyType.intVector, id: 20, uid: 41728)
237+
try entityBuilder.addProperty(name: "int64Array", type: PropertyType.longVector, id: 21, uid: 42496)
238+
try entityBuilder.addProperty(name: "floatArray", type: PropertyType.floatVector, id: 22, uid: 43520)
239+
try entityBuilder.addProperty(name: "stringArray", type: PropertyType.stringVector, id: 23, uid: 44544)
237240

238-
try entityBuilder.lastProperty(id: 20, uid: 41728)
241+
try entityBuilder.lastProperty(id: 23, uid: 44544)
239242
}
240243
}
241244

@@ -358,8 +361,26 @@ extension TypeTest {
358361
///
359362
/// You may want to use this in queries to specify fetch conditions, for example:
360363
///
361-
/// box.query { TypeTest.floatArray.isNotNil() }
362-
internal static var floatArray: Property<TypeTest, FloatArrayPropertyType, Void> { return Property<TypeTest, FloatArrayPropertyType, Void>(propertyId: 20, isPrimaryKey: false) }
364+
/// box.query { TypeTest.int32Array.isGreaterThan(value) }
365+
internal static var int32Array: Property<TypeTest, Int32ArrayPropertyType, Void> { return Property<TypeTest, Int32ArrayPropertyType, Void>(propertyId: 20, isPrimaryKey: false) }
366+
/// Generated entity property information.
367+
///
368+
/// You may want to use this in queries to specify fetch conditions, for example:
369+
///
370+
/// box.query { TypeTest.int64Array.isGreaterThan(value) }
371+
internal static var int64Array: Property<TypeTest, Int64ArrayPropertyType, Void> { return Property<TypeTest, Int64ArrayPropertyType, Void>(propertyId: 21, isPrimaryKey: false) }
372+
/// Generated entity property information.
373+
///
374+
/// You may want to use this in queries to specify fetch conditions, for example:
375+
///
376+
/// box.query { TypeTest.floatArray.isGreaterThan(value) }
377+
internal static var floatArray: Property<TypeTest, FloatArrayPropertyType, Void> { return Property<TypeTest, FloatArrayPropertyType, Void>(propertyId: 22, isPrimaryKey: false) }
378+
/// Generated entity property information.
379+
///
380+
/// You may want to use this in queries to specify fetch conditions, for example:
381+
///
382+
/// box.query { TypeTest.stringArray.containsElement(element: "<value>", caseSensitive: true) }
383+
internal static var stringArray: Property<TypeTest, StringArrayPropertyType, Void> { return Property<TypeTest, StringArrayPropertyType, Void>(propertyId: 23, isPrimaryKey: false) }
363384

364385
fileprivate func __setId(identifier: ObjectBox.Id) {
365386
self.id = EntityId(identifier)
@@ -519,13 +540,37 @@ extension ObjectBox.Property where E == TypeTest {
519540

520541
internal static var dateValue: Property<TypeTest, Date, Void> { return Property<TypeTest, Date, Void>(propertyId: 19, isPrimaryKey: false) }
521542

543+
/// Generated entity property information.
544+
///
545+
/// You may want to use this in queries to specify fetch conditions, for example:
546+
///
547+
/// box.query { .int32Array.isNotNil() }
548+
549+
internal static var int32Array: Property<TypeTest, Int32ArrayPropertyType, Void> { return Property<TypeTest, Int32ArrayPropertyType, Void>(propertyId: 20, isPrimaryKey: false) }
550+
551+
/// Generated entity property information.
552+
///
553+
/// You may want to use this in queries to specify fetch conditions, for example:
554+
///
555+
/// box.query { .int64Array.isNotNil() }
556+
557+
internal static var int64Array: Property<TypeTest, Int64ArrayPropertyType, Void> { return Property<TypeTest, Int64ArrayPropertyType, Void>(propertyId: 21, isPrimaryKey: false) }
558+
522559
/// Generated entity property information.
523560
///
524561
/// You may want to use this in queries to specify fetch conditions, for example:
525562
///
526563
/// box.query { .floatArray.isNotNil() }
527564

528-
internal static var floatArray: Property<TypeTest, FloatArrayPropertyType, Void> { return Property<TypeTest, FloatArrayPropertyType, Void>(propertyId: 20, isPrimaryKey: false) }
565+
internal static var floatArray: Property<TypeTest, FloatArrayPropertyType, Void> { return Property<TypeTest, FloatArrayPropertyType, Void>(propertyId: 22, isPrimaryKey: false) }
566+
567+
/// Generated entity property information.
568+
///
569+
/// You may want to use this in queries to specify fetch conditions, for example:
570+
///
571+
/// box.query { .stringArray.containsElement(element: "<value>", caseSensitive: true) }
572+
573+
internal static var stringArray: Property<TypeTest, StringArrayPropertyType, Void> { return Property<TypeTest, StringArrayPropertyType, Void>(propertyId: 23, isPrimaryKey: false) }
529574

530575
}
531576

@@ -552,7 +597,10 @@ internal final class TypeTestBinding: ObjectBox.EntityBinding, Sendable {
552597
let propertyOffset_stringValue = propertyCollector.prepare(string: entity.stringValue)
553598
let propertyOffset_bytes = propertyCollector.prepare(bytes: entity.bytes)
554599
let propertyOffset_byteArray = propertyCollector.prepare(bytes: entity.byteArray)
600+
let propertyOffset_int32Array = propertyCollector.prepare(values: entity.int32Array)
601+
let propertyOffset_int64Array = propertyCollector.prepare(values: entity.int64Array)
555602
let propertyOffset_floatArray = propertyCollector.prepare(values: entity.floatArray)
603+
let propertyOffset_stringArray = propertyCollector.prepare(values: entity.stringArray)
556604

557605
propertyCollector.collect(id, at: 2 + 2 * 1)
558606
propertyCollector.collect(entity.intValue, at: 2 + 2 * 2)
@@ -573,7 +621,10 @@ internal final class TypeTestBinding: ObjectBox.EntityBinding, Sendable {
573621
propertyCollector.collect(dataOffset: propertyOffset_stringValue, at: 2 + 2 * 13)
574622
propertyCollector.collect(dataOffset: propertyOffset_bytes, at: 2 + 2 * 15)
575623
propertyCollector.collect(dataOffset: propertyOffset_byteArray, at: 2 + 2 * 16)
576-
propertyCollector.collect(dataOffset: propertyOffset_floatArray, at: 2 + 2 * 20)
624+
propertyCollector.collect(dataOffset: propertyOffset_int32Array, at: 2 + 2 * 20)
625+
propertyCollector.collect(dataOffset: propertyOffset_int64Array, at: 2 + 2 * 21)
626+
propertyCollector.collect(dataOffset: propertyOffset_floatArray, at: 2 + 2 * 22)
627+
propertyCollector.collect(dataOffset: propertyOffset_stringArray, at: 2 + 2 * 23)
577628
}
578629

579630
internal func createEntity(entityReader: ObjectBox.FlatBufferReader, store: ObjectBox.Store) -> EntityType {
@@ -598,7 +649,10 @@ internal final class TypeTestBinding: ObjectBox.EntityBinding, Sendable {
598649
entity.floatValue = entityReader.read(at: 2 + 2 * 17)
599650
entity.doubleValue = entityReader.read(at: 2 + 2 * 18)
600651
entity.dateValue = entityReader.read(at: 2 + 2 * 19)
601-
entity.floatArray = entityReader.read(at: 2 + 2 * 20)
652+
entity.int32Array = entityReader.read(at: 2 + 2 * 20)
653+
entity.int64Array = entityReader.read(at: 2 + 2 * 21)
654+
entity.floatArray = entityReader.read(at: 2 + 2 * 22)
655+
entity.stringArray = entityReader.read(at: 2 + 2 * 23)
602656

603657
return entity
604658
}
@@ -617,7 +671,7 @@ fileprivate func cModel() throws -> OpaquePointer {
617671
let modelBuilder = try ObjectBox.ModelBuilder()
618672
try AnnotatedType.buildEntity(modelBuilder: modelBuilder)
619673
try TypeTest.buildEntity(modelBuilder: modelBuilder)
620-
modelBuilder.lastEntity(id: 2, uid: 42496)
674+
modelBuilder.lastEntity(id: 2, uid: 45568)
621675
return modelBuilder.finish()
622676
}
623677

Source/ios-framework/CodeGenTests/expected/entity-info/EntityInfo.generated59.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ extension CityAllProperties {
4747
///
4848
/// You may want to use this in queries to specify fetch conditions, for example:
4949
///
50-
/// box.query { CityAllProperties.coordinates.isNotNil() }
50+
/// box.query { CityAllProperties.coordinates.isGreaterThan(value) }
5151
internal static var coordinates: Property<CityAllProperties, HnswIndexPropertyType, Void> { return Property<CityAllProperties, HnswIndexPropertyType, Void>(propertyId: 2, isPrimaryKey: false) }
5252

5353
fileprivate func __setId(identifier: ObjectBox.Id) {
@@ -149,7 +149,7 @@ extension CityDefaults {
149149
///
150150
/// You may want to use this in queries to specify fetch conditions, for example:
151151
///
152-
/// box.query { CityDefaults.coordinatesDefaults.isNotNil() }
152+
/// box.query { CityDefaults.coordinatesDefaults.isGreaterThan(value) }
153153
internal static var coordinatesDefaults: Property<CityDefaults, HnswIndexPropertyType, Void> { return Property<CityDefaults, HnswIndexPropertyType, Void>(propertyId: 2, isPrimaryKey: false) }
154154

155155
fileprivate func __setId(identifier: ObjectBox.Id) {

Source/ios-framework/CodeGenTests/expected/model/model25.json

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
"relations": []
4949
},
5050
{
51-
"id": "2:42496",
52-
"lastPropertyId": "20:41728",
51+
"id": "2:45568",
52+
"lastPropertyId": "23:44544",
5353
"name": "TypeTest",
5454
"properties": [
5555
{
@@ -154,14 +154,29 @@
154154
},
155155
{
156156
"id": "20:41728",
157+
"name": "int32Array",
158+
"type": 26
159+
},
160+
{
161+
"id": "21:42496",
162+
"name": "int64Array",
163+
"type": 27
164+
},
165+
{
166+
"id": "22:43520",
157167
"name": "floatArray",
158168
"type": 28
169+
},
170+
{
171+
"id": "23:44544",
172+
"name": "stringArray",
173+
"type": 30
159174
}
160175
],
161176
"relations": []
162177
}
163178
],
164-
"lastEntityId": "2:42496",
179+
"lastEntityId": "2:45568",
165180
"lastIndexId": "0:0",
166181
"lastRelationId": "0:0",
167182
"lastSequenceId": "0:0",

0 commit comments

Comments
 (0)