Skip to content

Commit dabe04a

Browse files
README: move Swift Package instructions before CocoaPods
1 parent 9284a8d commit dabe04a

File tree

1 file changed

+58
-58
lines changed

1 file changed

+58
-58
lines changed

README.md

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -92,68 +92,12 @@ Check out the [installation section below](#add-objectbox-to-your-project). You
9292

9393
ObjectBox is available as a
9494

95-
- [CocoaPods](#cocoapods) pod
9695
- [Swift Package](#swift-package)
97-
98-
### CocoaPods
99-
100-
If you are new to CocoaPods, [check out their website](https://cocoapods.org) for an introduction and installation
101-
instructions.
102-
103-
To add the ObjectBox Swift dependency, add the following line to your `Podfile`:
104-
105-
```
106-
pod 'ObjectBox'
107-
```
108-
109-
Then install the pod and run the ObjectBox setup script:
110-
111-
```bash
112-
pod install --repo-update
113-
Pods/ObjectBox/setup.rb
114-
```
115-
116-
The `setup.rb` script will configure your Xcode project to run ObjectBox generator on every build by adding a build
117-
phase (called "[OBX] Update Sourcery Generated Files") for every target with an executable.
118-
119-
**Disable the User Script Sandboxing** option in your Xcode project build settings to allow the ObjectBox generator
120-
script to run.
121-
122-
> [!NOTE]
123-
> The ObjectBox code generator needs to run in the project directory and will generate files there. If this is executed
124-
> in a sandbox, the build phase will fail.
125-
126-
Then, open your Xcode workspace (.xcworkspace) instead of the Xcode project (.xcodeproj).
127-
128-
Now, you are all set to define your first ObjectBox entities! To continue check the
129-
[Getting Started guide](https://swift.objectbox.io/getting-started) or [the example project](#example).
130-
131-
#### Troubleshoot setup issues
132-
133-
If installing the pod or configuring the project failed, try to update the xcodeproj and cocoapods gem:
134-
135-
```bash
136-
gem update xcodeproj && gem update cocoapods && pod repo update
137-
```
138-
139-
> [!NOTE]
140-
> On Apple Silicon (M1), ensure you have the latest gems for CocoaPods:
141-
>
142-
> `gem update ffi ethon`
143-
144-
#### Update to a new version
145-
146-
After a new version of ObjectBox Swift is released, update the ObjectBox pod and run the setup script again:
147-
148-
```bash
149-
pod repo update
150-
pod update ObjectBox
151-
Pods/ObjectBox/setup.rb
152-
```
96+
- [CocoaPods](#cocoapods) pod
15397

15498
### Swift Package
15599

156-
Instructions depend on whether you want to set up an Xcode project or a Swift Package Manager manifest.
100+
Instructions depend on whether you want to set up an Xcode project (to build iOS and macOS apps) or a Swift Package Manager manifest.
157101

158102
#### Set up an Xcode project
159103

@@ -213,6 +157,62 @@ targets: [
213157
Now, you are all set to define your first ObjectBox entities! To continue check the
214158
[Getting Started guide](https://swift.objectbox.io/getting-started) or [the example project](#example).
215159

160+
### CocoaPods
161+
162+
If you are new to CocoaPods, [check out their website](https://cocoapods.org) for an introduction and installation
163+
instructions.
164+
165+
To add the ObjectBox Swift dependency, add the following line to your `Podfile`:
166+
167+
```
168+
pod 'ObjectBox'
169+
```
170+
171+
Then install the pod and run the ObjectBox setup script:
172+
173+
```bash
174+
pod install --repo-update
175+
Pods/ObjectBox/setup.rb
176+
```
177+
178+
The `setup.rb` script will configure your Xcode project to run ObjectBox generator on every build by adding a build
179+
phase (called "[OBX] Update Sourcery Generated Files") for every target with an executable.
180+
181+
**Disable the User Script Sandboxing** option in your Xcode project build settings to allow the ObjectBox generator
182+
script to run.
183+
184+
> [!NOTE]
185+
> The ObjectBox code generator needs to run in the project directory and will generate files there. If this is executed
186+
> in a sandbox, the build phase will fail.
187+
188+
Then, open your Xcode workspace (.xcworkspace) instead of the Xcode project (.xcodeproj).
189+
190+
Now, you are all set to define your first ObjectBox entities! To continue check the
191+
[Getting Started guide](https://swift.objectbox.io/getting-started) or [the example project](#example).
192+
193+
#### Troubleshoot setup issues
194+
195+
If installing the pod or configuring the project failed, try to update the xcodeproj and cocoapods gem:
196+
197+
```bash
198+
gem update xcodeproj && gem update cocoapods && pod repo update
199+
```
200+
201+
> [!NOTE]
202+
> On Apple Silicon (M1), ensure you have the latest gems for CocoaPods:
203+
>
204+
> `gem update ffi ethon`
205+
206+
#### Update to a new version
207+
208+
After a new version of ObjectBox Swift is released, update the ObjectBox pod and run the setup script again:
209+
210+
```bash
211+
pod repo update
212+
pod update ObjectBox
213+
Pods/ObjectBox/setup.rb
214+
```
215+
216216
### Recommended Xcode project settings
217217

218218
ObjectBox Swift does not include Bitcode, so you may need to adjust "Build Settings" in Xcode accordingly. In that tab,

0 commit comments

Comments
 (0)