Skip to content

Commit b2c2bdd

Browse files
committed
swift 4 fixes
1 parent c0b1293 commit b2c2bdd

File tree

8 files changed

+28
-20
lines changed

8 files changed

+28
-20
lines changed

Scorocode.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = 'Scorocode'
3-
s.version = '1.02'
4-
s.summary = 'Scorocode ios SDK, swift 3'
3+
s.version = '1.03'
4+
s.summary = 'Scorocode ios SDK, swift 4'
55

66
s.description = <<-DESC
77
SDK предоставляет доступ к платформе Scorocode для построения приложений, основанных на swift.

ScorocodeTests/TestSCAPI.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,7 @@ class TestSCAPI: XCTestCase {
375375
let exp = expectation(description: "Scripts")
376376

377377
// TODO: успешное выполнение
378-
379-
SCAPI.sharedInstance.runScript("abc", pool: [:], debug: false) {
378+
SCAPI.sharedInstance.runScript(scriptId: "abc", scriptPath: nil, pool: [:], debug: false) {
380379
success, error in
381380

382381
assertError(success: success, error: error, result: nil)

ScorocodeTests/TestSCUser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class TestSCUser: XCTestCase {
7171

7272
XCTAssertNotNil(result!["sessionId"])
7373

74-
SCUser.logout() {
74+
user.logout() {
7575
success, error in
7676

7777
XCTAssertTrue(success)

todolist.xcodeproj/project.pbxproj

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,14 +347,14 @@
347347
622100EC1EE05986002664DD = {
348348
CreatedOnToolsVersion = 8.3;
349349
DevelopmentTeam = Q9F94SAMUV;
350-
LastSwiftMigration = 0830;
350+
LastSwiftMigration = 0900;
351351
ProvisioningStyle = Automatic;
352352
TestTargetID = 6277357F1DBFD92300CFC713;
353353
};
354354
6277357F1DBFD92300CFC713 = {
355355
CreatedOnToolsVersion = 8.0;
356356
DevelopmentTeam = Q9F94SAMUV;
357-
LastSwiftMigration = 0830;
357+
LastSwiftMigration = 0900;
358358
ProvisioningStyle = Automatic;
359359
SystemCapabilities = {
360360
com.apple.BackgroundModes = {
@@ -528,7 +528,8 @@
528528
PRODUCT_BUNDLE_IDENTIFIER = com.scorocode.scorocodeTests;
529529
PRODUCT_NAME = "$(TARGET_NAME)";
530530
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
531-
SWIFT_VERSION = 3.0;
531+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
532+
SWIFT_VERSION = 4.0;
532533
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/todolist.app/todolist";
533534
};
534535
name = Debug;
@@ -545,7 +546,8 @@
545546
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
546547
PRODUCT_BUNDLE_IDENTIFIER = com.scorocode.scorocodeTests;
547548
PRODUCT_NAME = "$(TARGET_NAME)";
548-
SWIFT_VERSION = 3.0;
549+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
550+
SWIFT_VERSION = 4.0;
549551
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/todolist.app/todolist";
550552
};
551553
name = Release;
@@ -677,7 +679,8 @@
677679
PROVISIONING_PROFILE = "";
678680
PROVISIONING_PROFILE_SPECIFIER = "";
679681
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
680-
SWIFT_VERSION = 3.0;
682+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
683+
SWIFT_VERSION = 4.0;
681684
};
682685
name = Debug;
683686
};
@@ -696,7 +699,8 @@
696699
PRODUCT_NAME = "$(TARGET_NAME)";
697700
PROVISIONING_PROFILE = "";
698701
PROVISIONING_PROFILE_SPECIFIER = "";
699-
SWIFT_VERSION = 3.0;
702+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
703+
SWIFT_VERSION = 4.0;
700704
};
701705
name = Release;
702706
};

todolist/AppDelegate.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3535
}
3636

3737
//scorocode init
38-
let applicationId = "0b0fdf86cf064d118f2df6ca485937af"
39-
let clientId = "adeb3bf2410d488bbf57dede2812f3ee"
40-
let accessKey = "b28b2afa06e24ad481aa358b23210a73"
41-
let fileKey = "3824781956324a7a81025d7e6594d901"
42-
let messageKey = "9de581d126554bf2bf304f3dd7af2142"
38+
let applicationId = "0b0adf87cf064d118f2df6ca485937af"
39+
let clientId = "adeb3bf8810d388bbf57dede2812f3ee"
40+
let accessKey = "b28b2afa05e14ad481aa358b23210a73"
41+
let fileKey = "3824781938324a8a81025d7e6594d901"
42+
let messageKey = "9de581f126354bf2bf304f3dd7af2142"
4343
SC.initWith(applicationId: applicationId, clientId: clientId, accessKey: accessKey, fileKey: fileKey, messageKey: messageKey)
4444

4545
// Check if launched from notification

todolist/Extensions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extension UIViewController {
3434
}
3535

3636
// resize view on show keyboard
37-
func keyboardWillShowForResizing(notification: Notification) {
37+
@objc func keyboardWillShowForResizing(notification: Notification) {
3838
if let keyboardSize = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue,
3939
let window = self.view.window?.frame {
4040
self.view.frame = CGRect(x: self.view.frame.origin.x,
@@ -47,7 +47,7 @@ extension UIViewController {
4747
}
4848

4949
// resize view on hide keyboard
50-
func keyboardWillHideForResizing(notification: Notification) {
50+
@objc func keyboardWillHideForResizing(notification: Notification) {
5151
if let keyboardSize = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue {
5252
let viewHeight = self.view.frame.height
5353
self.view.frame = CGRect(x: self.view.frame.origin.x,
@@ -68,7 +68,7 @@ extension UIViewController {
6868
view.addGestureRecognizer(tap)
6969
}
7070

71-
func dismissKeyboard() {
71+
@objc func dismissKeyboard() {
7272
view.endEditing(true)
7373
}
7474
}

todolist/SCLib/BSON/bson.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,9 @@ func dictionaryFromBSONBytes(byteArray: [UInt8]) -> [String:Any] {
127127

128128
func arrayFromBSONBytes(byteArray: [UInt8]) -> [Any] {
129129
let dictionary = dictionaryFromBSONBytes(byteArray: byteArray)
130-
return dictionary.sorted(by: { Int($0.0.0)! < Int($0.1.0)! }).map({$0.1})
130+
return dictionary.sorted(by: { (a, b) -> Bool in
131+
return a.key < b.key
132+
}).map({ (a) -> Any in
133+
return a.value
134+
})
131135
}

todolist/SCLib/Model/SC.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Foundation
1111
public class SC {
1212

1313
public class func initWith(applicationId: String, clientId: String, accessKey: String, fileKey: String, messageKey: String) {
14+
1415
SCAPI.sharedInstance.applicationId = applicationId
1516
SCAPI.sharedInstance.clientId = clientId
1617
SCAPI.sharedInstance.accessKey = accessKey

0 commit comments

Comments
 (0)