Skip to content

Commit 4c3fe69

Browse files
committed
Merge branch 'objectbox-swift#204-update-to-rc10' into 'dev'
objectbox-swift#204 Build fixes for changes in 1.0rc10 See merge request objectbox/objectbox-swift-public!6
2 parents 95aa18e + 56c9755 commit 4c3fe69

File tree

7 files changed

+22
-9
lines changed

7 files changed

+22
-9
lines changed

Example/NotesExample-iOS/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
3333
let noteBox = Services.instance.noteBox
3434
let authorBox = Services.instance.authorBox
3535

36-
guard noteBox.isEmpty() && authorBox.isEmpty() else { return }
36+
guard try noteBox.isEmpty() && authorBox.isEmpty() else { return }
3737

3838
try Services.instance.replaceWithDemoData()
3939
}

Example/NotesExample-iOS/MasterViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ extension MasterViewController {
5050

5151
if indexPath.section == 0 {
5252
if indexPath.row == 0 {
53-
cell.detailTextLabel?.text = "\(noteBox.count())"
53+
cell.detailTextLabel?.text = "\(try! noteBox.count())"
5454
} else if indexPath.row == 1 {
55-
cell.detailTextLabel?.text = "\(authorBox.count())"
55+
cell.detailTextLabel?.text = "\(try! authorBox.count())"
5656
}
5757
}
5858

Example/NotesExample-iOS/NoteEditingViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ extension NoteEditingViewController: UIPickerViewDelegate {
166166
let pickerItems: [String]
167167

168168
init(authorBox: Box<Author>) {
169-
self.authors = authorBox.all().sorted(by: { $0.name < $1.name })
169+
self.authors = try! authorBox.all().sorted(by: { $0.name < $1.name })
170170
self.pickerItems = authors
171171
.map { $0.name }
172172
.prepending("(None)")

Example/NotesExample-iOS/NotesOverviewViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class NotesOverviewViewController: UITableViewController {
2424
self.authorId = authorId
2525

2626
if let authorId = authorId {
27-
query = noteBox.query { Note.author == authorId }.build()
27+
query = try! noteBox.query { Note.author == authorId }.build()
2828
} else {
29-
query = noteBox.query().build()
29+
query = try! noteBox.query().build()
3030
}
3131
}
3232

Example/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use_frameworks!
22

33
target 'NotesExample-iOS' do
44
platform :ios, :deployment_target => '11.0'
5-
pod 'ObjectBox', '1.0.0-rc.7'
5+
pod 'ObjectBox', '1.0.0-rc.10'
66
end
77

88
target 'NotesExample-macOS' do
99
platform :osx, :deployment_target => '10.10'
10-
pod 'ObjectBox', '1.0.0-rc.7'
10+
pod 'ObjectBox', '1.0.0-rc.10'
1111
end

Example/Shared/Author.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Author {
77
var id: EntityId<Author> // An `EntityId<Author>` is required by ObjectBox
88
var name: String
99
// objectbox: backlink = "author"
10-
var notes: ToMany<Note, Author>
10+
var notes: ToMany<Note>
1111

1212
// An initializer with no parameters is required by ObjectBox
1313
required init() {

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,19 @@ Source code
112112
-----------
113113
Source code for ObjectBox's Swift binding can be found [in the Source folder](Source/README.md).
114114

115+
Migrating from the Beta
116+
-----------------------
117+
118+
If you've used the ObjectBox betas, there are a few changes we made for the 1.0 release to
119+
improve the experience before we freeze the API for release. The adjustments you'll have to make are:
120+
121+
1. `isEmpty()`, `count()`, `all()`, `sum()`, `min()`, `max()` etc. are now functions to make it clearer they may perform a database lookup and aren't just properties to read.
122+
2. `putImmutable()` is now gone. Just call `put()` instead, it now returns the IDs like `putImmutable` used to.
123+
3. The old `Id<>` type has been renamed to `EntityId<>`. There is now a new `Id` type that does not use generics.
124+
4. Changes to standalone relations need to be saved explicitly using a call to `applyToDb()`.
125+
5. Most calls have been revised to now throw errors, so you'll have to add the requisite `try` statements.
126+
6. `ToMany` has been revised to no longer need the containing type as a second generic parameter, so change any `ToMany<A, B>` in your code to `ToMany<A>`.
127+
115128
Other languages/bindings
116129
------------------------
117130
ObjectBox is a multi platform database supporting [multiple languages](https://objectbox.io/dev-get-started/):

0 commit comments

Comments
 (0)