Skip to content

Commit ad6ddb3

Browse files
Merge pull request #45 from Iterable/feature/mob-153-upgrade-to-swift-4_2
[MOB-153] - Update to Swift 4.2
2 parents c2f3582 + 8009c15 commit ad6ddb3

10 files changed

+41
-39
lines changed

Iterable-iOS-AppExtensions.podspec

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

1818
s.name = "Iterable-iOS-AppExtensions"
1919
s.module_name = "IterableAppExtensions"
20-
s.version = "6.0.5"
20+
s.version = "6.0.6"
2121
s.summary = "App Extensions for Iterable SDK"
2222

2323
s.description = <<-DESC
@@ -80,8 +80,8 @@ Pod::Spec.new do |s|
8080
# s.public_header_files = "Classes/**/*.h"
8181

8282
s.pod_target_xcconfig = {
83-
'SWIFT_VERSION' => '4.1'
83+
'SWIFT_VERSION' => '4.2'
8484
}
8585

86-
s.swift_version = '4.1'
86+
s.swift_version = '4.2'
8787
end

Iterable-iOS-SDK.podspec

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

1818
s.name = "Iterable-iOS-SDK"
1919
s.module_name = "IterableSDK"
20-
s.version = "6.0.5"
20+
s.version = "6.0.6"
2121
s.summary = "Iterable's official SDK for iOS"
2222

2323
s.description = <<-DESC
@@ -75,8 +75,8 @@ Pod::Spec.new do |s|
7575
s.source_files = "swift-sdk/**/*.{h,m,swift}"
7676

7777
s.pod_target_xcconfig = {
78-
'SWIFT_VERSION' => '4.1'
78+
'SWIFT_VERSION' => '4.2'
7979
}
8080

81-
s.swift_version = '4.1'
81+
s.swift_version = '4.2'
8282
end

Tests/swift-sdk-swift-tests/IterableAPITests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ class IterableAPITests: XCTestCase {
593593
]
594594
]
595595
]
596-
let launchOptions: [UIApplicationLaunchOptionsKey : Any] = [UIApplicationLaunchOptionsKey.remoteNotification : userInfo]
596+
let launchOptions: [UIApplication.LaunchOptionsKey : Any] = [UIApplication.LaunchOptionsKey.remoteNotification : userInfo]
597597
let customActionDelegate = MockCustomActionDelegate(returnValue: false)
598598
customActionDelegate.callback = {(name, _) in
599599
XCTAssertEqual(name, "customAction")
@@ -622,7 +622,7 @@ class IterableAPITests: XCTestCase {
622622
]
623623
]
624624
]
625-
let launchOptions: [UIApplicationLaunchOptionsKey : Any] = [UIApplicationLaunchOptionsKey.remoteNotification : userInfo]
625+
let launchOptions: [UIApplication.LaunchOptionsKey : Any] = [UIApplication.LaunchOptionsKey.remoteNotification : userInfo]
626626
let urlDelegate = MockUrlDelegate(returnValue: true)
627627
urlDelegate.callback = {(url, _) in
628628
XCTAssertEqual(url.absoluteString, "http://somewhere.com")

Tests/swift-sdk-swift-tests/IterableInAppNotificationTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class IterableInAppNotificationTests: XCTestCase {
4545

4646
func testGetPaddingInvalid() {
4747
let insets = IterableInAppManager.getPaddingFromPayload([:])
48-
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(insets, UIEdgeInsets.zero))
48+
XCTAssertEqual(insets, UIEdgeInsets.zero)
4949
}
5050

5151
func testGetPaddingFull() {
@@ -57,14 +57,14 @@ class IterableInAppNotificationTests: XCTestCase {
5757
]
5858

5959
let insets = IterableInAppManager.getPaddingFromPayload(payload)
60-
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(insets, UIEdgeInsets.zero))
60+
XCTAssertEqual(insets, UIEdgeInsets.zero)
6161

6262
var padding = UIEdgeInsets.zero
6363
padding.top = CGFloat(IterableInAppManager.decodePadding(payload["top"]))
6464
padding.left = CGFloat(IterableInAppManager.decodePadding(payload["left"]))
6565
padding.bottom = CGFloat(IterableInAppManager.decodePadding(payload["bottom"]))
6666
padding.right = CGFloat(IterableInAppManager.decodePadding(payload["right"]))
67-
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(padding, UIEdgeInsets.zero))
67+
XCTAssertEqual(padding, UIEdgeInsets.zero)
6868
}
6969

7070
func testGetPaddingCenter() {
@@ -76,14 +76,14 @@ class IterableInAppNotificationTests: XCTestCase {
7676
]
7777

7878
let insets = IterableInAppManager.getPaddingFromPayload(payload)
79-
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(insets, UIEdgeInsets(top: -1, left: 0, bottom: -1, right: 0)))
79+
XCTAssertEqual(insets, UIEdgeInsets(top: -1, left: 0, bottom: -1, right: 0))
8080

8181
var padding = UIEdgeInsets.zero
8282
padding.top = CGFloat(IterableInAppManager.decodePadding(payload["top"]))
8383
padding.left = CGFloat(IterableInAppManager.decodePadding(payload["left"]))
8484
padding.bottom = CGFloat(IterableInAppManager.decodePadding(payload["bottom"]))
8585
padding.right = CGFloat(IterableInAppManager.decodePadding(payload["right"]))
86-
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(padding, UIEdgeInsets(top: -1, left: 0, bottom: -1, right: 0)))
86+
XCTAssertEqual(padding, UIEdgeInsets(top: -1, left: 0, bottom: -1, right: 0))
8787
}
8888

8989
func testGetPaddingTop() {
@@ -95,14 +95,14 @@ class IterableInAppNotificationTests: XCTestCase {
9595
]
9696

9797
let insets = IterableInAppManager.getPaddingFromPayload(payload)
98-
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(insets, UIEdgeInsets(top: 0, left: 0, bottom: -1, right: 0)))
98+
XCTAssertEqual(insets, UIEdgeInsets(top: 0, left: 0, bottom: -1, right: 0))
9999

100100
var padding = UIEdgeInsets.zero
101101
padding.top = CGFloat(IterableInAppManager.decodePadding(payload["top"]))
102102
padding.left = CGFloat(IterableInAppManager.decodePadding(payload["left"]))
103103
padding.bottom = CGFloat(IterableInAppManager.decodePadding(payload["bottom"]))
104104
padding.right = CGFloat(IterableInAppManager.decodePadding(payload["right"]))
105-
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(padding, UIEdgeInsets(top: 0, left: 0, bottom: -1, right: 0)))
105+
XCTAssertEqual(padding, UIEdgeInsets(top: 0, left: 0, bottom: -1, right: 0))
106106
}
107107

108108
func testGetPaddingBottom() {
@@ -114,14 +114,14 @@ class IterableInAppNotificationTests: XCTestCase {
114114
]
115115

116116
let insets = IterableInAppManager.getPaddingFromPayload(payload)
117-
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(insets, UIEdgeInsets(top: -1, left: 0, bottom: 0, right: 0)))
117+
XCTAssertEqual(insets, UIEdgeInsets(top: -1, left: 0, bottom: 0, right: 0))
118118

119119
var padding = UIEdgeInsets.zero
120120
padding.top = CGFloat(IterableInAppManager.decodePadding(payload["top"]))
121121
padding.left = CGFloat(IterableInAppManager.decodePadding(payload["left"]))
122122
padding.bottom = CGFloat(IterableInAppManager.decodePadding(payload["bottom"]))
123123
padding.right = CGFloat(IterableInAppManager.decodePadding(payload["right"]))
124-
XCTAssertTrue(UIEdgeInsetsEqualToEdgeInsets(padding, UIEdgeInsets(top: -1, left: 0, bottom: 0, right: 0)))
124+
XCTAssertEqual(padding, UIEdgeInsets(top: -1, left: 0, bottom: 0, right: 0))
125125
}
126126

127127
func testNotificationPaddingFull() {

host-app/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1717

1818
var window: UIWindow?
1919

20-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
20+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
2121
// Override point for customization after application launch.
2222

2323
let config = IterableConfig()

swift-sdk.xcodeproj/project.pbxproj

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,7 @@
11731173
SDKROOT = iphoneos;
11741174
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
11751175
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1176+
SWIFT_VERSION = 4.2;
11761177
VERSIONING_SYSTEM = "apple-generic";
11771178
VERSION_INFO_PREFIX = "";
11781179
};
@@ -1230,6 +1231,7 @@
12301231
SDKROOT = iphoneos;
12311232
SWIFT_COMPILATION_MODE = wholemodule;
12321233
SWIFT_OPTIMIZATION_LEVEL = "-O";
1234+
SWIFT_VERSION = 4.2;
12331235
VALIDATE_PRODUCT = YES;
12341236
VERSIONING_SYSTEM = "apple-generic";
12351237
VERSION_INFO_PREFIX = "";
@@ -1260,7 +1262,7 @@
12601262
PRODUCT_NAME = IterableSDK;
12611263
PROVISIONING_PROFILE_SPECIFIER = "";
12621264
SKIP_INSTALL = YES;
1263-
SWIFT_VERSION = 4.0;
1265+
SWIFT_VERSION = 4.2;
12641266
TARGETED_DEVICE_FAMILY = "1,2";
12651267
};
12661268
name = Debug;
@@ -1290,7 +1292,7 @@
12901292
PRODUCT_NAME = IterableSDK;
12911293
PROVISIONING_PROFILE_SPECIFIER = "";
12921294
SKIP_INSTALL = YES;
1293-
SWIFT_VERSION = 4.0;
1295+
SWIFT_VERSION = 4.2;
12941296
TARGETED_DEVICE_FAMILY = "1,2";
12951297
};
12961298
name = Release;
@@ -1310,7 +1312,7 @@
13101312
);
13111313
PRODUCT_BUNDLE_IDENTIFIER = "iterable.swift-sdk-swift-tests";
13121314
PRODUCT_NAME = "$(TARGET_NAME)";
1313-
SWIFT_VERSION = 4.0;
1315+
SWIFT_VERSION = 4.2;
13141316
TARGETED_DEVICE_FAMILY = "1,2";
13151317
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/host-app.app/host-app";
13161318
};
@@ -1331,7 +1333,7 @@
13311333
);
13321334
PRODUCT_BUNDLE_IDENTIFIER = "iterable.swift-sdk-swift-tests";
13331335
PRODUCT_NAME = "$(TARGET_NAME)";
1334-
SWIFT_VERSION = 4.0;
1336+
SWIFT_VERSION = 4.2;
13351337
TARGETED_DEVICE_FAMILY = "1,2";
13361338
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/host-app.app/host-app";
13371339
};
@@ -1364,7 +1366,7 @@
13641366
PRODUCT_NAME = "$(TARGET_NAME)";
13651367
SWIFT_OBJC_BRIDGING_HEADER = "Tests/swift-sdk-objc-tests/swift-sdk-objc-tests-Bridging-Header.h";
13661368
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1367-
SWIFT_VERSION = 4.0;
1369+
SWIFT_VERSION = 4.2;
13681370
TARGETED_DEVICE_FAMILY = "1,2";
13691371
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/host-app.app/host-app";
13701372
};
@@ -1396,7 +1398,7 @@
13961398
PRODUCT_BUNDLE_IDENTIFIER = "iterable.swift-sdk-objc-tests";
13971399
PRODUCT_NAME = "$(TARGET_NAME)";
13981400
SWIFT_OBJC_BRIDGING_HEADER = "Tests/swift-sdk-objc-tests/swift-sdk-objc-tests-Bridging-Header.h";
1399-
SWIFT_VERSION = 4.0;
1401+
SWIFT_VERSION = 4.2;
14001402
TARGETED_DEVICE_FAMILY = "1,2";
14011403
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/host-app.app/host-app";
14021404
};
@@ -1428,7 +1430,7 @@
14281430
PROVISIONING_PROFILE_SPECIFIER = "";
14291431
SKIP_INSTALL = YES;
14301432
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1431-
SWIFT_VERSION = 4.0;
1433+
SWIFT_VERSION = 4.2;
14321434
TARGETED_DEVICE_FAMILY = "1,2";
14331435
};
14341436
name = Debug;
@@ -1458,7 +1460,7 @@
14581460
PRODUCT_NAME = IterableAppExtensions;
14591461
PROVISIONING_PROFILE_SPECIFIER = "";
14601462
SKIP_INSTALL = YES;
1461-
SWIFT_VERSION = 4.0;
1463+
SWIFT_VERSION = 4.2;
14621464
TARGETED_DEVICE_FAMILY = "1,2";
14631465
};
14641466
name = Release;
@@ -1481,7 +1483,7 @@
14811483
PRODUCT_NAME = "$(TARGET_NAME)";
14821484
SWIFT_OBJC_BRIDGING_HEADER = "Tests/notification-extension-tests/notification-extensionTests-Bridging-Header.h";
14831485
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1484-
SWIFT_VERSION = 4.0;
1486+
SWIFT_VERSION = 4.2;
14851487
TARGETED_DEVICE_FAMILY = "1,2";
14861488
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/host-app.app/host-app";
14871489
};
@@ -1504,7 +1506,7 @@
15041506
PRODUCT_BUNDLE_IDENTIFIER = "iterable.notification-extensionTests";
15051507
PRODUCT_NAME = "$(TARGET_NAME)";
15061508
SWIFT_OBJC_BRIDGING_HEADER = "Tests/notification-extension-tests/notification-extensionTests-Bridging-Header.h";
1507-
SWIFT_VERSION = 4.0;
1509+
SWIFT_VERSION = 4.2;
15081510
TARGETED_DEVICE_FAMILY = "1,2";
15091511
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/host-app.app/host-app";
15101512
};
@@ -1569,7 +1571,7 @@
15691571
);
15701572
PRODUCT_BUNDLE_IDENTIFIER = "iterable.host-app";
15711573
PRODUCT_NAME = "$(TARGET_NAME)";
1572-
SWIFT_VERSION = 4.0;
1574+
SWIFT_VERSION = 4.2;
15731575
TARGETED_DEVICE_FAMILY = "1,2";
15741576
};
15751577
name = Debug;
@@ -1590,7 +1592,7 @@
15901592
);
15911593
PRODUCT_BUNDLE_IDENTIFIER = "iterable.host-app";
15921594
PRODUCT_NAME = "$(TARGET_NAME)";
1593-
SWIFT_VERSION = 4.0;
1595+
SWIFT_VERSION = 4.2;
15941596
TARGETED_DEVICE_FAMILY = "1,2";
15951597
};
15961598
name = Release;

swift-sdk/Internal/IterableAPIInternal.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ final class IterableAPIInternal : NSObject, PushTrackerProtocol {
668668
// MARK: Initialization
669669
// Package private method. Do not call this directly.
670670
init(apiKey: String,
671-
launchOptions: [UIApplicationLaunchOptionsKey: Any]? = nil,
671+
launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil,
672672
config: IterableConfig = IterableConfig(),
673673
dateProvider: DateProviderProtocol = SystemDateProvider(),
674674
networkSession: @escaping @autoclosure () -> NetworkSessionProtocol = URLSession(configuration: URLSessionConfiguration.default),
@@ -710,7 +710,7 @@ final class IterableAPIInternal : NSObject, PushTrackerProtocol {
710710
}
711711

712712
static func initialize(apiKey: String,
713-
launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil,
713+
launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil,
714714
config: IterableConfig = IterableConfig()) -> IterableAPIInternal {
715715
queue.sync {
716716
_sharedInstance = IterableAPIInternal(apiKey: apiKey,
@@ -722,11 +722,11 @@ final class IterableAPIInternal : NSObject, PushTrackerProtocol {
722722
return _sharedInstance!
723723
}
724724

725-
private func handle(launchOptions: [UIApplicationLaunchOptionsKey: Any]?) {
725+
private func handle(launchOptions: [UIApplication.LaunchOptionsKey: Any]?) {
726726
guard let launchOptions = launchOptions else {
727727
return
728728
}
729-
if let remoteNotificationPayload = launchOptions[UIApplicationLaunchOptionsKey.remoteNotification] as? [AnyHashable : Any] {
729+
if let remoteNotificationPayload = launchOptions[UIApplication.LaunchOptionsKey.remoteNotification] as? [AnyHashable : Any] {
730730
if let _ = IterableUtil.rootViewController {
731731
// we are ready
732732
IterableAppIntegration.implementation?.performDefaultNotificationAction(remoteNotificationPayload)

swift-sdk/Internal/IterableAppIntegrationInternal.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct UserNotificationResponse : NotificationResponseProtocol {
8686

8787
/// Abstraction of applicationState
8888
@objc public protocol ApplicationStateProviderProtocol : class {
89-
@objc var applicationState: UIApplicationState {get}
89+
@objc var applicationState: UIApplication.State {get}
9090
}
9191

9292
extension UIApplication : ApplicationStateProviderProtocol {

swift-sdk/Internal/IterableInAppHTMLViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ extension IterableInAppHTMLViewController : UIWebViewDelegate {
202202
}
203203
}
204204

205-
func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {
205+
func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebView.NavigationType) -> Bool {
206206
guard navigationType == .linkClicked, let url = request.url else {
207207
return true
208208
}

swift-sdk/IterableAPI.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Foundation
1212
@objcMembers
1313
public final class IterableAPI : NSObject {
1414
// Current SDK Version.
15-
static let sdkVersion = "6.0.5"
15+
static let sdkVersion = "6.0.6"
1616

1717
// MARK: Initialization
1818
/// You should call this method and not call the init method directly.
@@ -33,7 +33,7 @@ public final class IterableAPI : NSObject {
3333
/// - parameter apiKey: Iterable API Key.
3434
/// - parameter launchOptions: The launchOptions coming from application:didLaunching:withOptions
3535
public static func initialize(apiKey: String,
36-
launchOptions: [UIApplicationLaunchOptionsKey: Any]?) {
36+
launchOptions: [UIApplication.LaunchOptionsKey: Any]?) {
3737
initialize(apiKey: apiKey, launchOptions: launchOptions, config: IterableConfig())
3838
}
3939

@@ -42,7 +42,7 @@ public final class IterableAPI : NSObject {
4242
/// - parameter launchOptions: The launchOptions coming from application:didLaunching:withOptions
4343
/// - parameter config: Iterable config object.
4444
public static func initialize(apiKey: String,
45-
launchOptions: [UIApplicationLaunchOptionsKey: Any]? = nil,
45+
launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil,
4646
config: IterableConfig = IterableConfig()) {
4747
internalImplementation = IterableAPIInternal.initialize(apiKey: apiKey, launchOptions: launchOptions, config:config)
4848
}

0 commit comments

Comments
 (0)