Skip to content

Commit

Permalink
swift 5
Browse files Browse the repository at this point in the history
  • Loading branch information
hongxinhope committed Apr 3, 2019
1 parent 151b8ae commit 7664585
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 23 deletions.
15 changes: 8 additions & 7 deletions HanziPinyin.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,22 @@
D395A11C1CC244BB00B76FB7 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = Teambition;
TargetAttributes = {
D395A1241CC244BB00B76FB7 = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
};
};
};
buildConfigurationList = D395A11F1CC244BB00B76FB7 /* Build configuration list for PBXProject "HanziPinyin" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = D395A11B1CC244BB00B76FB7;
productRefGroup = D395A1261CC244BB00B76FB7 /* Products */;
Expand Down Expand Up @@ -179,6 +180,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -238,6 +240,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -304,8 +307,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;
};
name = Debug;
};
Expand All @@ -325,8 +327,7 @@
PRODUCT_BUNDLE_IDENTIFIER = Teambition.HanziPinyin;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion HanziPinyin/HanziPinyin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation

internal struct HanziCodePoint {
static let start:UInt32 = 0x4E00
static let start: UInt32 = 0x4E00
static let end: UInt32 = 0x9FFF
}

Expand Down
2 changes: 1 addition & 1 deletion HanziPinyin/HanziPinyinResource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ private struct CacheKeys {
}

internal extension HanziPinyin {
internal func initializeResource() -> [String: String] {
func initializeResource() -> [String: String] {
if let cachedPinyinTable = HanziPinyin.cachedObject(forKey: CacheKeys.unicodeToPinyin) as? [String: String] {
return cachedPinyinTable
} else {
Expand Down
10 changes: 5 additions & 5 deletions HanziPinyin/String+HanziPinyin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation

public extension String {
public func toPinyin(withFormat outputFormat: PinyinOutputFormat = .default, separator: String = " ") -> String {
func toPinyin(withFormat outputFormat: PinyinOutputFormat = .default, separator: String = " ") -> String {
var pinyinStrings = [String]()
for unicodeScalar in unicodeScalars {
let charCodePoint = unicodeScalar.value
Expand All @@ -30,7 +30,7 @@ public extension String {
return pinyin
}

public func toPinyin(withFormat outputFormat: PinyinOutputFormat = .default, separator: String = " ", completion: @escaping ((_ pinyin: String) -> ())) {
func toPinyin(withFormat outputFormat: PinyinOutputFormat = .default, separator: String = " ", completion: @escaping ((_ pinyin: String) -> ())) {
DispatchQueue.global(qos: .default).async {
let pinyin = self.toPinyin(withFormat: outputFormat, separator: separator)
DispatchQueue.main.async {
Expand All @@ -39,7 +39,7 @@ public extension String {
}
}

public func toPinyinAcronym(withFormat outputFormat: PinyinOutputFormat = .default, separator: String = "") -> String {
func toPinyinAcronym(withFormat outputFormat: PinyinOutputFormat = .default, separator: String = "") -> String {
var pinyinStrings = [String]()
for unicodeScalar in unicodeScalars {
let charCodePoint = unicodeScalar.value
Expand All @@ -61,7 +61,7 @@ public extension String {
return pinyinAcronym
}

public func toPinyinAcronym(withFormat outputFormat: PinyinOutputFormat = .default, separator: String = "", completion: @escaping ((_ pinyinAcronym: String) -> ())) {
func toPinyinAcronym(withFormat outputFormat: PinyinOutputFormat = .default, separator: String = "", completion: @escaping ((_ pinyinAcronym: String) -> ())) {
DispatchQueue.global(qos: .default).async {
let pinyinAcronym = self.toPinyinAcronym(withFormat: outputFormat, separator: separator)
DispatchQueue.main.async {
Expand All @@ -70,7 +70,7 @@ public extension String {
}
}

public var hasChineseCharacter: Bool {
var hasChineseCharacter: Bool {
for unicodeScalar in unicodeScalars {
let charCodePoint = unicodeScalar.value
if HanziPinyin.isHanzi(ofCharCodePoint: charCodePoint) {
Expand Down
2 changes: 1 addition & 1 deletion HanziPinyin/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.0.7</string>
<string>0.0.8</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
10 changes: 6 additions & 4 deletions HanziPinyinExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = Teambition;
TargetAttributes = {
D395A1051CC243DB00B76FB7 = {
Expand All @@ -122,7 +122,7 @@
};
buildConfigurationList = D395A1011CC243DB00B76FB7 /* Build configuration list for PBXProject "HanziPinyinExample" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -179,6 +179,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -235,6 +236,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -290,7 +292,7 @@
PRODUCT_BUNDLE_IDENTIFIER = Teambition.HanziPinyinExample;
PRODUCT_NAME = HanziPinyinExample;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -303,7 +305,7 @@
PRODUCT_BUNDLE_IDENTIFIER = Teambition.HanziPinyinExample;
PRODUCT_NAME = HanziPinyinExample;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 2 additions & 2 deletions HanziPinyinExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.7</string>
<string>0.0.8</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>7</string>
<string>8</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
Expand Down

0 comments on commit 7664585

Please sign in to comment.