Skip to content

Commit

Permalink
convert to Swift 5
Browse files Browse the repository at this point in the history
  • Loading branch information
nixzhu committed Apr 3, 2019
1 parent 125cafd commit 7acfbaa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2
5.0
17 changes: 7 additions & 10 deletions China.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,12 @@
TargetAttributes = {
50FBA6B41BA2AFAD00E69BB3 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
50FBA6CE1BA2BBE900E69BB3 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
};
};
};
Expand All @@ -266,6 +266,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -490,8 +491,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.nixWork.China;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -508,8 +508,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.nixWork.China;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -531,8 +530,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -555,8 +553,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.nixWork.MonkeyKing;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ MonkeyKing also supports **OAuth** and **Mobile payment** via WeChat and Alipay!

## Requirements

Swift 4.2, iOS 8
Swift 5, iOS 8

(For Swift 4.2, use version 1.13.0)

(For Swift 4.1/4.0, use version 1.11.0)

Expand Down
8 changes: 2 additions & 6 deletions Sources/MonkeyKing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ public class MonkeyKing: NSObject {
}
}

public var hashValue: Int {
return appID.hashValue
}

public func hash(into hasher: inout Hasher) {
hasher.combine(appID)
}
Expand Down Expand Up @@ -212,7 +208,7 @@ extension MonkeyKing {

guard
let account = shared.accountSet[.weChat],
let info = dict?[account.appID] as? [String: Any],
let info = dict[account.appID] as? [String: Any],
let result = info["result"] as? String,
let resultCode = Int(result) else {
return false
Expand Down Expand Up @@ -399,7 +395,7 @@ extension MonkeyKing {
guard
let data = UIPasteboard.general.data(forPasteboardType: "com.alipay.openapi.pb.resp.\(appID)"),
let dict = try? PropertyListSerialization.propertyList(from: data, options: PropertyListSerialization.MutabilityOptions(), format: nil) as? [String: Any],
let objects = dict?["$objects"] as? NSArray,
let objects = dict["$objects"] as? NSArray,
let result = objects[12] as? Int else {
return false
}
Expand Down

0 comments on commit 7acfbaa

Please sign in to comment.