Skip to content

Commit f65e0e1

Browse files
Merge branch 'example-spm' into 'main'
Migrate Example from CocoaPods to SPM objectbox-swift#328 See merge request objectbox/objectbox-swift-public!23
2 parents 42b4a5c + 1747852 commit f65e0e1

File tree

14 files changed

+829
-57
lines changed

14 files changed

+829
-57
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ build_project:
66
tags: [mac, x64, xcode]
77
script:
88
- cd Example
9-
- pod repo update
10-
- pod install
11-
- Pods/ObjectBox/setup.rb
12-
- xcodebuild clean build -workspace NotesExample.xcworkspace -scheme NotesExample-macOS -destination 'platform=OS X,arch=x86_64'
9+
- xcodebuild clean build -scheme NotesExample-macOS -destination 'platform=OS X,arch=x86_64'
1310

1411
variables:
1512
GIT_SUBMODULE_STRATEGY: recursive

Example/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

Example/.ruby-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

Example/NotesExample.xcodeproj/project.pbxproj

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
15C9FDDF2E29E0A300E02BD9 /* ObjectBox.xcframework in Frameworks */ = {isa = PBXBuildFile; productRef = 15C9FDDE2E29E0A300E02BD9 /* ObjectBox.xcframework */; };
11+
15C9FDE12E29E0B000E02BD9 /* ObjectBox.xcframework in Frameworks */ = {isa = PBXBuildFile; productRef = 15C9FDE02E29E0B000E02BD9 /* ObjectBox.xcframework */; };
12+
15C9FDEA2E29E26B00E02BD9 /* EntityInfo-NotesExample-iOS.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15C9FDE72E29E26400E02BD9 /* EntityInfo-NotesExample-iOS.generated.swift */; };
13+
15C9FDEB2E29E27100E02BD9 /* EntityInfo-NotesExample-macOS.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15C9FDE82E29E26400E02BD9 /* EntityInfo-NotesExample-macOS.generated.swift */; };
1014
5039ECA02181DA350095204F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5039EC9F2181DA350095204F /* AppDelegate.swift */; };
1115
5039ECA22181DA350095204F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5039ECA12181DA350095204F /* ViewController.swift */; };
1216
5039ECA42181DA360095204F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5039ECA32181DA360095204F /* Assets.xcassets */; };
@@ -33,6 +37,8 @@
3337
/* End PBXBuildFile section */
3438

3539
/* Begin PBXFileReference section */
40+
15C9FDE72E29E26400E02BD9 /* EntityInfo-NotesExample-iOS.generated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "EntityInfo-NotesExample-iOS.generated.swift"; sourceTree = "<group>"; };
41+
15C9FDE82E29E26400E02BD9 /* EntityInfo-NotesExample-macOS.generated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "EntityInfo-NotesExample-macOS.generated.swift"; sourceTree = "<group>"; };
3642
5039EC9D2181DA350095204F /* NotesExample-macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "NotesExample-macOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
3743
5039EC9F2181DA350095204F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
3844
5039ECA12181DA350095204F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
@@ -53,7 +59,6 @@
5359
5070AAFB218066C1002305F8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5460
5070AAFD218066C1002305F8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5561
5070AB1421809535002305F8 /* Note.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Note.swift; sourceTree = "<group>"; };
56-
5070AB16218095DA002305F8 /* Podfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Podfile; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
5762
50DC4E822188617A00DF7253 /* Services.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Services.swift; sourceTree = "<group>"; };
5863
50DC4E862188963F00DF7253 /* NotesOverviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotesOverviewViewController.swift; sourceTree = "<group>"; };
5964
50DC4E9D2189961F00DF7253 /* Array+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+Extensions.swift"; sourceTree = "<group>"; };
@@ -68,19 +73,30 @@
6873
isa = PBXFrameworksBuildPhase;
6974
buildActionMask = 2147483647;
7075
files = (
76+
15C9FDE12E29E0B000E02BD9 /* ObjectBox.xcframework in Frameworks */,
7177
);
7278
runOnlyForDeploymentPostprocessing = 0;
7379
};
7480
5070AAE9218066C0002305F8 /* Frameworks */ = {
7581
isa = PBXFrameworksBuildPhase;
7682
buildActionMask = 2147483647;
7783
files = (
84+
15C9FDDF2E29E0A300E02BD9 /* ObjectBox.xcframework in Frameworks */,
7885
);
7986
runOnlyForDeploymentPostprocessing = 0;
8087
};
8188
/* End PBXFrameworksBuildPhase section */
8289

8390
/* Begin PBXGroup section */
91+
15C9FDE92E29E26400E02BD9 /* generated */ = {
92+
isa = PBXGroup;
93+
children = (
94+
15C9FDE72E29E26400E02BD9 /* EntityInfo-NotesExample-iOS.generated.swift */,
95+
15C9FDE82E29E26400E02BD9 /* EntityInfo-NotesExample-macOS.generated.swift */,
96+
);
97+
path = generated;
98+
sourceTree = "<group>";
99+
};
84100
3DABC3C80306D2BD07D4938C /* Frameworks */ = {
85101
isa = PBXGroup;
86102
children = (
@@ -116,7 +132,7 @@
116132
5070AAE3218066C0002305F8 = {
117133
isa = PBXGroup;
118134
children = (
119-
5070AB16218095DA002305F8 /* Podfile */,
135+
15C9FDE92E29E26400E02BD9 /* generated */,
120136
5039ECAD2181DA4D0095204F /* Shared */,
121137
5070AAEE218066C0002305F8 /* NotesExample-iOS */,
122138
5039EC9E2181DA350095204F /* NotesExample-macOS */,
@@ -226,6 +242,9 @@
226242
Base,
227243
);
228244
mainGroup = 5070AAE3218066C0002305F8;
245+
packageReferences = (
246+
15C9FDDD2E29E0A300E02BD9 /* XCRemoteSwiftPackageReference "objectbox-swift-spm" */,
247+
);
229248
preferredProjectObjectVersion = 77;
230249
productRefGroup = 5070AAED218066C0002305F8 /* Products */;
231250
projectDirPath = "";
@@ -264,6 +283,7 @@
264283
isa = PBXSourcesBuildPhase;
265284
buildActionMask = 2147483647;
266285
files = (
286+
15C9FDEB2E29E27100E02BD9 /* EntityInfo-NotesExample-macOS.generated.swift in Sources */,
267287
5039ECA22181DA350095204F /* ViewController.swift in Sources */,
268288
5039ECBE2181E2C90095204F /* StoreHelper.swift in Sources */,
269289
5039ECA02181DA350095204F /* AppDelegate.swift in Sources */,
@@ -277,6 +297,7 @@
277297
isa = PBXSourcesBuildPhase;
278298
buildActionMask = 2147483647;
279299
files = (
300+
15C9FDEA2E29E26B00E02BD9 /* EntityInfo-NotesExample-iOS.generated.swift in Sources */,
280301
5051DF2F2190806800E2595A /* PlaceholderViewController.swift in Sources */,
281302
5039ECB52181DFFF0095204F /* Author.swift in Sources */,
282303
5070AAF4218066C0002305F8 /* NoteEditingViewController.swift in Sources */,
@@ -553,6 +574,30 @@
553574
defaultConfigurationName = Release;
554575
};
555576
/* End XCConfigurationList section */
577+
578+
/* Begin XCRemoteSwiftPackageReference section */
579+
15C9FDDD2E29E0A300E02BD9 /* XCRemoteSwiftPackageReference "objectbox-swift-spm" */ = {
580+
isa = XCRemoteSwiftPackageReference;
581+
repositoryURL = "https://github.com/objectbox/objectbox-swift-spm";
582+
requirement = {
583+
kind = upToNextMajorVersion;
584+
minimumVersion = 4.4.0;
585+
};
586+
};
587+
/* End XCRemoteSwiftPackageReference section */
588+
589+
/* Begin XCSwiftPackageProductDependency section */
590+
15C9FDDE2E29E0A300E02BD9 /* ObjectBox.xcframework */ = {
591+
isa = XCSwiftPackageProductDependency;
592+
package = 15C9FDDD2E29E0A300E02BD9 /* XCRemoteSwiftPackageReference "objectbox-swift-spm" */;
593+
productName = ObjectBox.xcframework;
594+
};
595+
15C9FDE02E29E0B000E02BD9 /* ObjectBox.xcframework */ = {
596+
isa = XCSwiftPackageProductDependency;
597+
package = 15C9FDDD2E29E0A300E02BD9 /* XCRemoteSwiftPackageReference "objectbox-swift-spm" */;
598+
productName = ObjectBox.xcframework;
599+
};
600+
/* End XCSwiftPackageProductDependency section */
556601
};
557602
rootObject = 5070AAE4218066C0002305F8 /* Project object */;
558603
}

Example/NotesExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/NotesExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/NotesExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

Lines changed: 0 additions & 8 deletions
This file was deleted.

Example/Podfile

Lines changed: 0 additions & 14 deletions
This file was deleted.

Example/README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
ObjectBox Example
2-
=================
3-
The "Notes" example app demonstrate ObjectBox's Swift API.
1+
# ObjectBox Example
2+
3+
This "Notes" example app demonstrates how to use the ObjectBox Swift API.
4+
45
The example comes with two apps: one for iOS and one for macOS. The iOS example is a full GUI application, whereas the macOS example runs a few operations and then exits.
56

6-
Example setup
7-
-------------
8-
Just like in any other project, you need to set up CocoaPods and ObjectBox.
9-
Simply run `./setup.sh` inside this directory, or run these commands in a terminal:
7+
## Other examples
8+
9+
- An example using the CocoaPods release is archived in the [`cocoapods-example` branch](https://github.com/objectbox/objectbox-swift/tree/cocoapods-example/Example)
10+
- An example using ObjectBox Sync is available in the [Sync examples repository](https://github.com/objectbox/objectbox-sync-examples)
11+
12+
## Example setup
13+
14+
Clone the repository and open the `Example` directory in Xcode, either through the GUI or from the command-line:
1015

11-
pod install --repo-update # if that fails, update CocoaPods (see Installation)
12-
Pods/ObjectBox/setup.rb
16+
```bash
17+
git clone --depth=1 https://github.com/objectbox/objectbox-swift
18+
cd objectbox-swift/Example
19+
open NotesExample.xcodeproj
20+
```
1321

14-
This will generate a `NotesExample.xcworkspace` that you can launch to try out ObjectBox.
22+
Use the `NotesExample-iOS` or `NotesExample-macOS` scheme to run the respective app.

0 commit comments

Comments
 (0)