Skip to content

Commit 543dfd1

Browse files
jaeoptthomaszurkan-optimizely
authored andcommitted
Add Swift Package Manager (SPM) support (#243)
* (wip) restructure for SPM * cleanup * restructure for SPM support * clean up * fix SPM source path * fix podspec for new SPM paths * remove header files from podspec * move swiftlint trigger to DemoApp to isolate it from Carthage package * add xcshareddata for schemes * add SPM instruction to README * fix Podfile error * fix project path for slather/coveralls * fix workspace path for travis * fix workspace path for slather/coveralls * turn off coverage for tvOS (iOS can be used for coverall) * fix per review
1 parent 6a13830 commit 543dfd1

File tree

188 files changed

+4530
-4635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+4530
-4635
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ xcuserdata/
3535
build
3636
*.xcodeproj/*
3737
!*.xcodeproj/project.pbxproj
38+
!*.xcodeproj/xcshareddata/
3839
!*.xcworkspace/contents.xcworkspacedata
3940

4041
# CocoaPods
@@ -52,6 +53,12 @@ Pods/
5253

5354
Carthage/Build
5455

56+
# SPM
57+
58+
.build
59+
.swiftpm
60+
Packages
61+
5562
# fastlane
5663
#
5764
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the

.slather.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
coverage_service: coveralls
2-
xcodeproj: OptimizelySDK/OptimizelySwiftSDK.xcodeproj
2+
xcodeproj: OptimizelySwiftSDK.xcodeproj
33
scheme: OptimizelySwiftSDK-iOS
4-
workspace: OptimizelySDK.xcworkspace
4+
workspace: OptimizelySwiftSDK.xcworkspace
55
configuration: Release

OptimizelySDK/.swiftlint.yml renamed to .swiftlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ excluded:
1010
- Carthage
1111
- Pods
1212
- SwiftLint/Common/3rdPartyLib
13-
- OptimizelyTests
13+
- Tests
1414
line_length:
1515
warning: 350
1616
error: 400
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
# preload simulator
6060
- Scripts/start_simulator.sh
6161
script:
62-
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then xcodebuild test -workspace OptimizelySDK.xcworkspace -scheme $SCHEME -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -sdk $TEST_SDK -destination "platform=$PLATFORM,OS=$OS,name=$NAME" ONLY_ACTIVE_ARCH=YES > buildoutput; cat buildoutput | xcpretty; fi
62+
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then xcodebuild test -workspace OptimizelySwiftSDK.xcworkspace -scheme $SCHEME -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -sdk $TEST_SDK -destination "platform=$PLATFORM,OS=$OS,name=$NAME" ONLY_ACTIVE_ARCH=YES > buildoutput; cat buildoutput | xcpretty; fi
6363
after_success:
6464
- slather
6565
- sleep 5 # https://github.com/travis-ci/travis-ci/issues/4725

DemoObjCApp/DemoObjcApp.xcodeproj/project.pbxproj

Lines changed: 114 additions & 112 deletions
Large diffs are not rendered by default.

DemoSwiftApp/AppDelegate.swift

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
174174
}
175175

176176
func openVariationView(variationKey: String?) {
177-
let variationViewController = storyboard.instantiateViewController(withIdentifier: "VariationViewController") as! VariationViewController
177+
if let variationViewController = storyboard.instantiateViewController(withIdentifier: "VariationViewController")
178+
as? VariationViewController {
178179

179-
variationViewController.showCoupon = optimizely.isFeatureEnabled(featureKey: "show_coupon",
180+
variationViewController.showCoupon = optimizely.isFeatureEnabled(featureKey: "show_coupon",
180181
userId: userId)
181-
variationViewController.optimizely = optimizely
182-
variationViewController.userId = userId
183-
variationViewController.variationKey = variationKey
184-
variationViewController.eventKey = eventKey
182+
variationViewController.optimizely = optimizely
183+
variationViewController.userId = userId
184+
variationViewController.variationKey = variationKey
185+
variationViewController.eventKey = eventKey
185186

186-
window?.rootViewController = variationViewController
187+
window?.rootViewController = variationViewController
188+
}
187189
}
188190

189191
func openFailureView() {
@@ -207,7 +209,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
207209
func applicationWillTerminate(_ application: UIApplication) {
208210
}
209211

210-
func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
212+
func application(_ application: UIApplication,
213+
performFetchWithCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
211214

212215
// add background fetch task here
213216

DemoSwiftApp/DemoSwiftApp.xcodeproj/project.pbxproj

Lines changed: 154 additions & 114 deletions
Large diffs are not rendered by default.

OptimizelySDK/OptimizelySwiftSDK.xcodeproj/project.pbxproj

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

OptimizelySwiftSDK.podspec

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Pod::Spec.new do |s|
22
s.name = "OptimizelySwiftSDK"
33
s.module_name = "Optimizely"
44
s.version = "3.1.0-beta"
5-
s.summary = "Optimizely server-side testing core framework."
6-
s.homepage = "http://developers.optimizely.com/server/reference/index.html?language=objectivec"
5+
s.summary = "Optimizely experiment framework for iOS/tvOS"
6+
s.homepage = "https://docs.developers.optimizely.com/full-stack/docs"
77
s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" }
88
s.author = { "Optimizely" => "support@optimizely.com" }
99
s.ios.deployment_target = "9.0"
@@ -12,10 +12,8 @@ Pod::Spec.new do |s|
1212
:git => "https://github.com/optimizely/swift-sdk.git",
1313
:tag => "v"+s.version.to_s
1414
}
15-
s.source_files = "OptimizelySDK/**/*.{swift,h}"
16-
s.public_header_files = "OptimizelySDK/OptimizelySwiftSDK/*.h"
17-
s.exclude_files = "OptimizelySDK/Optimizely*Tests/**/*"
18-
s.swift_version = "4.2"
15+
s.source_files = "Sources/**/*.swift"
16+
s.swift_version = "5.0"
1917
s.framework = "Foundation"
2018
s.requires_arc = true
2119
s.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => "OPTIMIZELY_SDK_VERSION=@\\\"#{s.version}\\\"" }

0 commit comments

Comments
 (0)