You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Source/README.md
+9-6Lines changed: 9 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -7,16 +7,14 @@ These Swift classes internally use [ObjectBox's C API](https://github.com/object
7
7
8
8
Repository Contents
9
9
-------------------
10
-
11
10
-`ios-framework/`: The Cocoa Swift framework.
12
11
-`docs/swift_output/`: The generated framework documentation.
13
12
-`external/`: git submodule and pre-built binary container. This contains the ObjectBoxCore static libraries and our code generator.
14
-
-`download_dependencies.command`: Script for downloading libObjectBoxCore into `externals`. You must run this script before you can build the framework.
13
+
-`fetch_dependencies.command`: Script for downloading libObjectBoxCore into `externals`. You must run this script before you can build the framework.
15
14
-`docs/`: Documentation and discussion of concepts, ideas, and approaches to bring ObjectBox to Swift.
16
15
17
16
Setup
18
17
-----
19
-
20
18
* Install latest Xcode (Swift 5.2+) with command line tools prepared to build from the shell
21
19
* Note: After Xcode updates, you may have to reinstall the CLI tools via `xcode-select --install`
22
20
* Ensure you have homebrew (e.g. setup.sh uses it to install [Carthage](https://github.com/Carthage/Carthage))
@@ -79,7 +77,6 @@ This is essentially what comes for free with Carthage. Xcode 10 changed the buil
79
77
80
78
Swift Framework Project Organization
81
79
------------------------------------
82
-
83
80
You look at and build the framework itself via `ios-framework/ObjectBox.xcodeproj`.
84
81
85
82
*`ObjectBox.xcproject` targets
@@ -98,14 +95,20 @@ You look at and build the framework itself via `ios-framework/ObjectBox.xcodepro
98
95
*`ObjectBox-macOS` contains macOS-specific files, including the framework's Info.plist
99
96
*`ObjectBox-iOS` contains iOS-specific files, including the framework's Info.plist
100
97
98
+
Build notes
99
+
-----------
100
+
* Build phases; check Xcode project
101
+
* "Rename C Header": takes the standard C objectbox.h and augments it with some Swift specifics into ObjectBoxC.h
102
+
(TODO: Can we do this differently, e.g. use the standard objectbox.h and then have a second .h for Swift specifics?)
* Edit .swiftlint-macOS.yml file to customize (e.g. "id" is OK despite less than 3 chars)
105
+
101
106
Caveats
102
107
-------
103
-
104
108
To make to-one relations and their backlinks work, the `Entity` protocol was extended to require (1) an `EntityType` typealias, and (2) an `_id` property. The former was needed to disambiguate which concrete entity we're talking about when all we have is the protocol type, and this in turn is needed to specify the generic type requirement of `Id<T>`. Since the `Entity` protocol itself is intended to be no more than a convenient code annotation (which Sourcery can filter on), it's advised to get rid of this as soon as possible and find a different way to get the data needed for associations in Swift, for example using an `IdGetter<T>` like we do in Java and injecting it into `EntityInfo` from generated code.
105
109
106
110
How to Use the Framework
107
111
------------------------
108
-
109
112
- The example project in this repository is a good starting point to see how to interact with the framework.
110
113
- Have a look at the `ios-framework/CommonTests/Test Entities/RelatedEntities.swift` file to see how self-contained entity code & generated cursor code look. You should be able to copy and paste the contents into a test app if you want. This should also help in case you cannot get the code generator running in 2024 :)
0 commit comments