Skip to content

Commit d3b9e92

Browse files
feat: update example apps to use SPM (#222)
* feat: update iOS Swift example app to SPM * feat: update tvOS example app * feat: cleanup iOS Example App * feat: update macos example app * feat: update obj-c iOS app
1 parent 9af155f commit d3b9e92

File tree

25 files changed

+165
-491
lines changed

25 files changed

+165
-491
lines changed

Examples/DevCycle-MacOS-Example-App/DevCycle-macOS-Example-App.xcodeproj/project.pbxproj

Lines changed: 31 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 56;
6+
objectVersion = 60;
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
0F4EEC672DDE6EEC00D9F4B5 /* DevCycle in Frameworks */ = {isa = PBXBuildFile; productRef = 0F4EEC662DDE6EEC00D9F4B5 /* DevCycle */; };
1011
0FFD249D29763D7A0025AF03 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD249C29763D7A0025AF03 /* AppDelegate.swift */; };
1112
0FFD249F29763D7A0025AF03 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD249E29763D7A0025AF03 /* ViewController.swift */; };
1213
0FFD24A129763D7B0025AF03 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0FFD24A029763D7B0025AF03 /* Assets.xcassets */; };
1314
0FFD24A429763D7B0025AF03 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0FFD24A229763D7B0025AF03 /* Main.storyboard */; };
1415
0FFD24AC29763DAC0025AF03 /* DevCycleManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD24AB29763DAC0025AF03 /* DevCycleManager.swift */; };
15-
35DEC4ADAE7D864C2F44064F /* Pods_DevCycle_macOS_Example_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CC3F5CE54D08D373FAC1E48 /* Pods_DevCycle_macOS_Example_App.framework */; };
1616
/* End PBXBuildFile section */
1717

1818
/* Begin PBXFileReference section */
@@ -23,19 +23,14 @@
2323
0FFD24A329763D7B0025AF03 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
2424
0FFD24A529763D7B0025AF03 /* DevCycle_macOS_Example_App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DevCycle_macOS_Example_App.entitlements; sourceTree = "<group>"; };
2525
0FFD24AB29763DAC0025AF03 /* DevCycleManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DevCycleManager.swift; sourceTree = "<group>"; };
26-
20BD3FBDAC055CF089320679 /* Pods-DevCycle-macOS-Example-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DevCycle-macOS-Example-App.debug.xcconfig"; path = "Target Support Files/Pods-DevCycle-macOS-Example-App/Pods-DevCycle-macOS-Example-App.debug.xcconfig"; sourceTree = "<group>"; };
27-
2CC3F5CE54D08D373FAC1E48 /* Pods_DevCycle_macOS_Example_App.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DevCycle_macOS_Example_App.framework; sourceTree = BUILT_PRODUCTS_DIR; };
28-
843AB517357F7E61158B6ABC /* Pods-DevCycle-MacOS-Example-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DevCycle-MacOS-Example-App.release.xcconfig"; path = "Target Support Files/Pods-DevCycle-MacOS-Example-App/Pods-DevCycle-MacOS-Example-App.release.xcconfig"; sourceTree = "<group>"; };
29-
AD92F9A88A2ADC4B3B71DFE4 /* Pods-DevCycle-MacOS-Example-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DevCycle-MacOS-Example-App.debug.xcconfig"; path = "Target Support Files/Pods-DevCycle-MacOS-Example-App/Pods-DevCycle-MacOS-Example-App.debug.xcconfig"; sourceTree = "<group>"; };
30-
EFEA79E49CBE0C36C2D7D170 /* Pods-DevCycle-macOS-Example-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DevCycle-macOS-Example-App.release.xcconfig"; path = "Target Support Files/Pods-DevCycle-macOS-Example-App/Pods-DevCycle-macOS-Example-App.release.xcconfig"; sourceTree = "<group>"; };
3126
/* End PBXFileReference section */
3227

3328
/* Begin PBXFrameworksBuildPhase section */
3429
0FFD249629763D7A0025AF03 /* Frameworks */ = {
3530
isa = PBXFrameworksBuildPhase;
3631
buildActionMask = 2147483647;
3732
files = (
38-
35DEC4ADAE7D864C2F44064F /* Pods_DevCycle_macOS_Example_App.framework in Frameworks */,
33+
0F4EEC672DDE6EEC00D9F4B5 /* DevCycle in Frameworks */,
3934
);
4035
runOnlyForDeploymentPostprocessing = 0;
4136
};
@@ -47,8 +42,6 @@
4742
children = (
4843
0FFD249B29763D7A0025AF03 /* DevCycle-macOS-Example-App */,
4944
0FFD249A29763D7A0025AF03 /* Products */,
50-
4825927CAF6A7327D6F6C2BC /* Pods */,
51-
5B9504658313D404E592891A /* Frameworks */,
5245
);
5346
sourceTree = "<group>";
5447
};
@@ -73,37 +66,16 @@
7366
path = "DevCycle-macOS-Example-App";
7467
sourceTree = "<group>";
7568
};
76-
4825927CAF6A7327D6F6C2BC /* Pods */ = {
77-
isa = PBXGroup;
78-
children = (
79-
AD92F9A88A2ADC4B3B71DFE4 /* Pods-DevCycle-MacOS-Example-App.debug.xcconfig */,
80-
843AB517357F7E61158B6ABC /* Pods-DevCycle-MacOS-Example-App.release.xcconfig */,
81-
20BD3FBDAC055CF089320679 /* Pods-DevCycle-macOS-Example-App.debug.xcconfig */,
82-
EFEA79E49CBE0C36C2D7D170 /* Pods-DevCycle-macOS-Example-App.release.xcconfig */,
83-
);
84-
path = Pods;
85-
sourceTree = "<group>";
86-
};
87-
5B9504658313D404E592891A /* Frameworks */ = {
88-
isa = PBXGroup;
89-
children = (
90-
2CC3F5CE54D08D373FAC1E48 /* Pods_DevCycle_macOS_Example_App.framework */,
91-
);
92-
name = Frameworks;
93-
sourceTree = "<group>";
94-
};
9569
/* End PBXGroup section */
9670

9771
/* Begin PBXNativeTarget section */
9872
0FFD249829763D7A0025AF03 /* DevCycle-macOS-Example-App */ = {
9973
isa = PBXNativeTarget;
10074
buildConfigurationList = 0FFD24A829763D7B0025AF03 /* Build configuration list for PBXNativeTarget "DevCycle-macOS-Example-App" */;
10175
buildPhases = (
102-
FDD8E4BAEDEA40A5C619BBF6 /* [CP] Check Pods Manifest.lock */,
10376
0FFD249529763D7A0025AF03 /* Sources */,
10477
0FFD249629763D7A0025AF03 /* Frameworks */,
10578
0FFD249729763D7A0025AF03 /* Resources */,
106-
BCDE6DA169F0AF93C304C98E /* [CP] Embed Pods Frameworks */,
10779
);
10880
buildRules = (
10981
);
@@ -122,7 +94,7 @@
12294
attributes = {
12395
BuildIndependentTargetsInParallel = 1;
12496
LastSwiftUpdateCheck = 1420;
125-
LastUpgradeCheck = 1420;
97+
LastUpgradeCheck = 1630;
12698
TargetAttributes = {
12799
0FFD249829763D7A0025AF03 = {
128100
CreatedOnToolsVersion = 14.2;
@@ -138,6 +110,9 @@
138110
Base,
139111
);
140112
mainGroup = 0FFD249029763D7A0025AF03;
113+
packageReferences = (
114+
0F4EEC652DDE6EEC00D9F4B5 /* XCLocalSwiftPackageReference "../../../ios-client-sdk" */,
115+
);
141116
productRefGroup = 0FFD249A29763D7A0025AF03 /* Products */;
142117
projectDirPath = "";
143118
projectRoot = "";
@@ -159,48 +134,6 @@
159134
};
160135
/* End PBXResourcesBuildPhase section */
161136

162-
/* Begin PBXShellScriptBuildPhase section */
163-
BCDE6DA169F0AF93C304C98E /* [CP] Embed Pods Frameworks */ = {
164-
isa = PBXShellScriptBuildPhase;
165-
buildActionMask = 2147483647;
166-
files = (
167-
);
168-
inputFileListPaths = (
169-
"${PODS_ROOT}/Target Support Files/Pods-DevCycle-macOS-Example-App/Pods-DevCycle-macOS-Example-App-frameworks-${CONFIGURATION}-input-files.xcfilelist",
170-
);
171-
name = "[CP] Embed Pods Frameworks";
172-
outputFileListPaths = (
173-
"${PODS_ROOT}/Target Support Files/Pods-DevCycle-macOS-Example-App/Pods-DevCycle-macOS-Example-App-frameworks-${CONFIGURATION}-output-files.xcfilelist",
174-
);
175-
runOnlyForDeploymentPostprocessing = 0;
176-
shellPath = /bin/sh;
177-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-DevCycle-macOS-Example-App/Pods-DevCycle-macOS-Example-App-frameworks.sh\"\n";
178-
showEnvVarsInLog = 0;
179-
};
180-
FDD8E4BAEDEA40A5C619BBF6 /* [CP] Check Pods Manifest.lock */ = {
181-
isa = PBXShellScriptBuildPhase;
182-
buildActionMask = 2147483647;
183-
files = (
184-
);
185-
inputFileListPaths = (
186-
);
187-
inputPaths = (
188-
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
189-
"${PODS_ROOT}/Manifest.lock",
190-
);
191-
name = "[CP] Check Pods Manifest.lock";
192-
outputFileListPaths = (
193-
);
194-
outputPaths = (
195-
"$(DERIVED_FILE_DIR)/Pods-DevCycle-macOS-Example-App-checkManifestLockResult.txt",
196-
);
197-
runOnlyForDeploymentPostprocessing = 0;
198-
shellPath = /bin/sh;
199-
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
200-
showEnvVarsInLog = 0;
201-
};
202-
/* End PBXShellScriptBuildPhase section */
203-
204137
/* Begin PBXSourcesBuildPhase section */
205138
0FFD249529763D7A0025AF03 /* Sources */ = {
206139
isa = PBXSourcesBuildPhase;
@@ -259,9 +192,12 @@
259192
CLANG_WARN_UNREACHABLE_CODE = YES;
260193
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
261194
COPY_PHASE_STRIP = NO;
195+
DEAD_CODE_STRIPPING = YES;
262196
DEBUG_INFORMATION_FORMAT = dwarf;
197+
DEVELOPMENT_TEAM = ASZYP8H6QE;
263198
ENABLE_STRICT_OBJC_MSGSEND = YES;
264199
ENABLE_TESTABILITY = YES;
200+
ENABLE_USER_SCRIPT_SANDBOXING = YES;
265201
GCC_C_LANGUAGE_STANDARD = gnu11;
266202
GCC_DYNAMIC_NO_PIC = NO;
267203
GCC_NO_COMMON_BLOCKS = YES;
@@ -319,9 +255,12 @@
319255
CLANG_WARN_UNREACHABLE_CODE = YES;
320256
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
321257
COPY_PHASE_STRIP = NO;
258+
DEAD_CODE_STRIPPING = YES;
322259
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
260+
DEVELOPMENT_TEAM = ASZYP8H6QE;
323261
ENABLE_NS_ASSERTIONS = NO;
324262
ENABLE_STRICT_OBJC_MSGSEND = YES;
263+
ENABLE_USER_SCRIPT_SANDBOXING = YES;
325264
GCC_C_LANGUAGE_STANDARD = gnu11;
326265
GCC_NO_COMMON_BLOCKS = YES;
327266
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -341,15 +280,14 @@
341280
};
342281
0FFD24A929763D7B0025AF03 /* Debug */ = {
343282
isa = XCBuildConfiguration;
344-
baseConfigurationReference = 20BD3FBDAC055CF089320679 /* Pods-DevCycle-macOS-Example-App.debug.xcconfig */;
345283
buildSettings = {
346284
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
347285
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
348286
CODE_SIGN_ENTITLEMENTS = "DevCycle-MacOS-Example-App/DevCycle_MacOS_Example_App.entitlements";
349287
CODE_SIGN_STYLE = Automatic;
350288
COMBINE_HIDPI_IMAGES = YES;
351289
CURRENT_PROJECT_VERSION = 1;
352-
DEVELOPMENT_TEAM = ASZYP8H6QE;
290+
DEAD_CODE_STRIPPING = YES;
353291
ENABLE_HARDENED_RUNTIME = YES;
354292
GENERATE_INFOPLIST_FILE = YES;
355293
INFOPLIST_KEY_NSHumanReadableCopyright = "";
@@ -359,7 +297,7 @@
359297
"$(inherited)",
360298
"@executable_path/../Frameworks",
361299
);
362-
MACOSX_DEPLOYMENT_TARGET = 10.15;
300+
MACOSX_DEPLOYMENT_TARGET = 11.0;
363301
MARKETING_VERSION = 1.0;
364302
PRODUCT_BUNDLE_IDENTIFIER = "com.devcycle.DevCycle-MacOS-Example-App";
365303
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -370,13 +308,12 @@
370308
};
371309
0FFD24AA29763D7B0025AF03 /* Release */ = {
372310
isa = XCBuildConfiguration;
373-
baseConfigurationReference = EFEA79E49CBE0C36C2D7D170 /* Pods-DevCycle-macOS-Example-App.release.xcconfig */;
374311
buildSettings = {
375312
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
376313
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
377314
CODE_SIGN_STYLE = Automatic;
378315
CURRENT_PROJECT_VERSION = 1;
379-
DEVELOPMENT_TEAM = ASZYP8H6QE;
316+
DEAD_CODE_STRIPPING = YES;
380317
GENERATE_INFOPLIST_FILE = YES;
381318
INFOPLIST_FILE = "DevCycle-MacOS-Example-App/Info.plist";
382319
INFOPLIST_KEY_NSHumanReadableCopyright = "";
@@ -386,7 +323,7 @@
386323
"$(inherited)",
387324
"@executable_path/../Frameworks",
388325
);
389-
MACOSX_DEPLOYMENT_TARGET = 10.15;
326+
MACOSX_DEPLOYMENT_TARGET = 11.0;
390327
MARKETING_VERSION = 1.0;
391328
PRODUCT_BUNDLE_IDENTIFIER = "com.devcycle.DevCycle-MacOS-Example-App";
392329
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -417,6 +354,20 @@
417354
defaultConfigurationName = Release;
418355
};
419356
/* End XCConfigurationList section */
357+
358+
/* Begin XCLocalSwiftPackageReference section */
359+
0F4EEC652DDE6EEC00D9F4B5 /* XCLocalSwiftPackageReference "../../../ios-client-sdk" */ = {
360+
isa = XCLocalSwiftPackageReference;
361+
relativePath = "../../../ios-client-sdk";
362+
};
363+
/* End XCLocalSwiftPackageReference section */
364+
365+
/* Begin XCSwiftPackageProductDependency section */
366+
0F4EEC662DDE6EEC00D9F4B5 /* DevCycle */ = {
367+
isa = XCSwiftPackageProductDependency;
368+
productName = DevCycle;
369+
};
370+
/* End XCSwiftPackageProductDependency section */
420371
};
421372
rootObject = 0FFD249129763D7A0025AF03 /* Project object */;
422373
}

Examples/DevCycle-MacOS-Example-App/DevCycle-macOS-Example-App/DevCycleManager.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ class DevCycleManager {
1616
static let shared = DevCycleManager()
1717

1818
func initialize(user: DevCycleUser) {
19-
print("DVC Manager Initialize")
2019
guard initializationTask == nil else { return }
2120
initializationTask = Task {
2221
let options = DevCycleOptions.builder()
@@ -26,15 +25,13 @@ class DevCycleManager {
2625
.user(user)
2726
.options(options)
2827
.build()
29-
print("DVC Manager ")
3028
self.client = client
3129
return client
3230
}
3331
}
3432

3533
var clientAsync: DevCycleClient? {
3634
get async {
37-
print("Get clientAsync")
3835
return await initializationTask?.value
3936
}
4037
}

Examples/DevCycle-MacOS-Example-App/DevCycle-macOS-Example-App/ViewController.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,13 @@ class ViewController: NSViewController {
5656
}
5757

5858
@IBAction func loginButtonPressed(_ sender: Any) {
59-
print("Login Button")
6059
let isCurrentlyLoggedIn = self.loggedIn
6160

6261
Task {
6362
guard let client = await DevCycleManager.shared.clientAsync else { return }
6463
if isCurrentlyLoggedIn {
6564
do {
66-
try await client.resetUser()
65+
_ = try await client.resetUser()
6766
self.setLoginButtonTitle(false)
6867
print("Reset User!")
6968
} catch {
@@ -84,13 +83,15 @@ class ViewController: NSViewController {
8483
"customkey2": "customValue2"
8584
])
8685
.build()
87-
try await client.identifyUser(user: user)
86+
_ = try await client.identifyUser(user: user)
87+
8888
self.setLoginButtonTitle(true)
89-
print("Logged in as User: \(String(describing: user.userId))!")
90-
let numKeyValue = client.variableValue(key: "num_key", defaultValue: 0)
89+
90+
let numKeyValue = client.variableValue(key: "num_key", defaultValue: Double(0))
9191
print("Num_key is \(numKeyValue)!")
92+
9293
let numKeyDefaultedValue = client.variableValue(
93-
key: "num_key_defaulted", defaultValue: 0)
94+
key: "num_key_defaulted", defaultValue: Double(0))
9495
print("Num_key_defaulted is \(numKeyDefaultedValue)!")
9596
} catch {
9697
print("Error identifying user: \(error)")

Examples/DevCycle-MacOS-Example-App/Podfile

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
## Install using CocoaPods
1+
# Install using Swift Package Manager
22

3-
### Install CocoaPods
3+
This example app is setup to use the local DevCycle iOS SDK from this git repo,
4+
but you can install the remote version of the SDK using SPM:
45

5-
https://guides.cocoapods.org/using/getting-started.html
6+
1. Open the project in Xcode.
7+
2. Go to **File > Add Packages...**
8+
3. Enter the DevCycle SDK repository URL:
69

7-
### Install dependencies
10+
```
11+
https://github.com/DevCycleHQ/ios-client-sdk.git
12+
```
13+
4. Choose the version you want to use and add the package to your app target.
814

9-
Run the following to install dependencies:
15+
# Run the app using the .xcodeproj file
1016

11-
```
12-
pod install
13-
```
17+
1. Open `DevCycle-macOS-Example-App.xcodeproj` in Xcode.
18+
2. Select the `DevCycle-macOS-Example-App` scheme from the scheme selector.
19+
3. Choose your desired target device (My Mac).
20+
4. Click the Run button (▶️) or press `Cmd + R` to build and run the app.

0 commit comments

Comments
 (0)