Skip to content

Commit 5ceb420

Browse files
authored
Merge pull request #6 from casperkclee/master
[Improvement] YM-13740: Migrate iOS Button SDK to Swift 5
2 parents 301e967 + 8656fef commit 5ceb420

File tree

7 files changed

+43
-18
lines changed

7 files changed

+43
-18
lines changed

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This repo contains the tools and step by step instructions so that your users ca
66
## Requirements
77
- You will need to have the Yoti app on your phone
88
- You will need to ensure the minimum version of the deployment target is 9.0 or above.
9+
- You will need Xcode 10.2 or above
910

1011
## Installing the SDK
1112

@@ -38,7 +39,7 @@ $ brew install carthage
3839
To integrate Yoti into your Xcode project using Carthage, specify it in your `Cartfile`:
3940

4041
```
41-
github "getyoti/ios-sdk-button" ~> 1.0
42+
github "getyoti/ios-sdk-button" ~> 2.0
4243
```
4344

4445
This will allow you to type `carthage update ios-sdk-button` in your Terminal to fetch and build the latest version of the framework.
@@ -48,13 +49,35 @@ Drag the built `YotiButtonSDK.framework` into your Xcode project without copying
4849

4950
Each time you want to fetch the dependency, you can type `carthage bootstrap`.
5051

51-
### Drag & Drop (not recommended)
52+
### CocoaPods
5253

53-
You can also add the Yoti SDK by adding the project via a submodule and dragging the Yoti's project file into yours.
54+
[CocoaPods](https://cocoapods.org) is a dependency manager for Swift and Objective-C Cocoa projects.
55+
56+
Using the default Ruby install can require you to use sudo when installing gems. Further installation instructions are in [the guides](https://guides.cocoapods.org/using/getting-started.html#getting-started).
57+
58+
```
59+
$ sudo gem install cocoapods
60+
```
61+
62+
To integrate Yoti into your Xcode project using Cocoapods, specify it in your `Podfile`:
63+
64+
```
65+
pod 'yoti-sdk' ~> 2.0
66+
```
67+
68+
Tip: CocoaPods provides a `pod init` command to create a Podfile with smart defaults. You should use it.
69+
70+
Now you can install the dependencies in your project:
5471

55-
### Pod
72+
```
73+
$ pod install
74+
```
5675

57-
We don't currently support Pod but it's coming soon.
76+
Make sure to always open the Xcode workspace instead of the project file when building your project.
77+
78+
### Drag & Drop (not recommended)
79+
80+
You can also add the Yoti SDK by adding the project via a submodule and dragging the Yoti's project file into yours.
5881

5982
## Configuration
6083
Before we start the configuration you have to add Yoti SDK as a build phase:

YotiButtonSDK.xcodeproj/project.pbxproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@
273273
isa = PBXProject;
274274
attributes = {
275275
LastSwiftUpdateCheck = 0830;
276-
LastUpgradeCheck = 0940;
276+
LastUpgradeCheck = 1020;
277277
ORGANIZATIONNAME = "Yoti Limited";
278278
TargetAttributes = {
279279
B43B0E0F1F22063800CD5E4E = {
@@ -291,7 +291,7 @@
291291
};
292292
buildConfigurationList = B43B0E0A1F22063800CD5E4E /* Build configuration list for PBXProject "YotiButtonSDK" */;
293293
compatibilityVersion = "Xcode 3.2";
294-
developmentRegion = English;
294+
developmentRegion = en;
295295
hasScannedForEncodings = 0;
296296
knownRegions = (
297297
en,
@@ -374,6 +374,7 @@
374374
isa = XCBuildConfiguration;
375375
buildSettings = {
376376
ALWAYS_SEARCH_USER_PATHS = NO;
377+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
377378
CLANG_ANALYZER_NONNULL = YES;
378379
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
379380
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
@@ -420,7 +421,7 @@
420421
ONLY_ACTIVE_ARCH = YES;
421422
SDKROOT = iphoneos;
422423
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
423-
SWIFT_VERSION = 4.0;
424+
SWIFT_VERSION = 5.0;
424425
TARGETED_DEVICE_FAMILY = "1,2";
425426
VALIDATE_PRODUCT = YES;
426427
VERSIONING_SYSTEM = "apple-generic";
@@ -465,6 +466,7 @@
465466
isa = XCBuildConfiguration;
466467
buildSettings = {
467468
ALWAYS_SEARCH_USER_PATHS = NO;
469+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
468470
CLANG_ANALYZER_NONNULL = YES;
469471
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
470472
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
@@ -509,7 +511,7 @@
509511
MTL_ENABLE_DEBUG_INFO = NO;
510512
SDKROOT = iphoneos;
511513
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
512-
SWIFT_VERSION = 4.0;
514+
SWIFT_VERSION = 5.0;
513515
TARGETED_DEVICE_FAMILY = "1,2";
514516
VALIDATE_PRODUCT = YES;
515517
VERSIONING_SYSTEM = "apple-generic";

YotiButtonSDK.xcodeproj/xcshareddata/xcschemes/YotiButtonSDK.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0940"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

YotiButtonSDK/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>2.0</string>
18+
<string>2.1</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSPrincipalClass</key>

YotiButtonSDK/YotiButton.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ public class YotiButton: UIButton {
5858
styleSubviews()
5959
}
6060

61-
public override func setTitle(_ title: String?, for state: UIControlState) {
61+
public override func setTitle(_ title: String?, for state: UIControl.State) {
6262
messageLabel.text = title
6363
messageLabel.sizeToFit()
6464
messageWidthConstraint?.constant = messageLabel.frame.width
6565

6666
}
6767

68-
public override func setTitleColor(_ color: UIColor?, for state: UIControlState) {
68+
public override func setTitleColor(_ color: UIColor?, for state: UIControl.State) {
6969
if let color = color {
7070
messageLabel.textColor = color
7171
}

YotiButtonSDK/YotiSDK.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ public class YotiSDK: NSObject {
7171

7272
// MARK: - UIApplication Delegate
7373

74-
@objc public static func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {
74+
@objc public static func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
7575
return shared.application(app, open: url, options: options)
7676
}
7777

78-
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {
78+
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
7979

80-
guard let bundleID = options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String,
80+
guard let bundleID = options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
8181
bundleID == EnvironmentConfiguation.YotiApp.bundleID
8282
else {
8383
return false

yoti-sdk.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "yoti-sdk"
19-
s.version = "1.1"
19+
s.version = "2.1"
2020
s.summary = "A button SDK that uses Yoti app to complete the share"
2121

2222
# This description is used to generate tags and improve search results.
@@ -65,7 +65,7 @@ Pod::Spec.new do |s|
6565

6666
# s.platform = :ios
6767
s.platform = :ios, "9.0"
68-
s.swift_version = '4.0'
68+
s.swift_version = '5.0'
6969

7070
# When using multiple platforms
7171
# s.ios.deployment_target = "5.0"

0 commit comments

Comments
 (0)