├── Gif
└── HanziPinyinExample.gif
├── HanziPinyinExample
├── HanziPinyinExample.playground
│ ├── contents.xcplayground
│ ├── Contents.swift
│ └── timeline.xctimeline
├── AppDelegate.swift
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Info.plist
├── ActivityButton.swift
├── HanziPinyinExampleViewController.swift
└── Base.lproj
│ └── Main.storyboard
├── HanziPinyinExample.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
├── xcuserdata
│ └── hongxin.xcuserdatad
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── HanziPinyinExample.xcscheme
└── project.pbxproj
├── HanziPinyin.xcworkspace
├── xcshareddata
│ └── IDEWorkspaceChecks.plist
└── contents.xcworkspacedata
├── HanziPinyin.xcodeproj
├── xcuserdata
│ └── hongxin.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
├── xcshareddata
│ └── xcschemes
│ │ └── HanziPinyin.xcscheme
└── project.pbxproj
├── HanziPinyin.podspec
├── HanziPinyin
├── Supporting Files
│ └── Info.plist
├── PinyinOutputFormat.swift
├── PinyinFormatter.swift
├── HanziPinyin.swift
├── String+HanziPinyin.swift
└── HanziPinyinResource.swift
├── LICENSE.md
├── .gitignore
└── README.md
/Gif/HanziPinyinExample.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/teambition/HanziPinyin/HEAD/Gif/HanziPinyinExample.gif
--------------------------------------------------------------------------------
/HanziPinyinExample/HanziPinyinExample.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/HanziPinyinExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/HanziPinyin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/HanziPinyin.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/HanziPinyinExample/HanziPinyinExample.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | //: Playground - noun: a place where people can play
2 |
3 | import UIKit
4 | import HanziPinyin
5 |
6 | print("我爱中文".toPinyin())
7 | print("I love Chinese.".toPinyin())
8 | print("我愛說中國話".toPinyin())
9 | print("我爱中文".toPinyinAcronym())
10 | print("I love Chinese.".toPinyinAcronym())
11 | print("我愛說中國話".toPinyinAcronym())
12 | print("我爱中文".hasChineseCharacter())
13 | print("I love Chinese.".hasChineseCharacter())
14 | print("我愛說中國話".hasChineseCharacter())
15 |
--------------------------------------------------------------------------------
/HanziPinyin.xcodeproj/xcuserdata/hongxin.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | HanziPinyin.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | D395A1241CC244BB00B76FB7
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/HanziPinyinExample.xcodeproj/xcuserdata/hongxin.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | HanziPinyinExample.xcscheme
8 |
9 | orderHint
10 | 1
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | D395A1051CC243DB00B76FB7
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/HanziPinyin.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 |
3 | s.name = "HanziPinyin"
4 | s.version = "1.0.0"
5 | s.summary = "A lightweight Swift library supporting convertion between Chinese(both Simplified and Tranditional) characters and Pinyin."
6 |
7 | s.homepage = "https://github.com/teambition/HanziPinyin"
8 | s.license = { :type => "MIT", :file => "LICENSE.md" }
9 | s.author = "Xin Hong"
10 |
11 | s.source = { :git => "https://github.com/teambition/HanziPinyin.git", :tag => s.version.to_s }
12 | s.source_files = "HanziPinyin/*.swift"
13 | s.resource_bundles = {
14 | 'HanziPinyin' => ['HanziPinyin/Resources/*.txt'],
15 | }
16 |
17 | s.platform = :ios, "8.0"
18 | s.requires_arc = true
19 |
20 | s.frameworks = "Foundation"
21 | s.swift_version = "5.0"
22 |
23 | end
24 |
--------------------------------------------------------------------------------
/HanziPinyin/Supporting Files/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/HanziPinyinExample/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // HanziPinyinExample
4 | //
5 | // Created by Xin Hong on 16/4/16.
6 | // Copyright © 2016年 Teambition. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 | var window: UIWindow?
14 |
15 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
16 | return true
17 | }
18 |
19 | func applicationWillResignActive(_ application: UIApplication) {
20 |
21 | }
22 |
23 | func applicationDidEnterBackground(_ application: UIApplication) {
24 |
25 | }
26 |
27 | func applicationWillEnterForeground(_ application: UIApplication) {
28 |
29 | }
30 |
31 | func applicationDidBecomeActive(_ application: UIApplication) {
32 |
33 | }
34 |
35 | func applicationWillTerminate(_ application: UIApplication) {
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/HanziPinyin/PinyinOutputFormat.swift:
--------------------------------------------------------------------------------
1 | //
2 | // PinyinOutputFormat.swift
3 | // HanziPinyin
4 | //
5 | // Created by Xin Hong on 16/4/16.
6 | // Copyright © 2016年 Teambition. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public enum PinyinToneType {
12 | case none
13 | case toneNumber
14 | }
15 |
16 | public enum PinyinVCharType {
17 | case vCharacter
18 | case uUnicode
19 | case uAndColon
20 | }
21 |
22 | public enum PinyinCaseType {
23 | case lowercased
24 | case uppercased
25 | case capitalized
26 | }
27 |
28 | public struct PinyinOutputFormat {
29 | public var toneType: PinyinToneType
30 | public var vCharType: PinyinVCharType
31 | public var caseType: PinyinCaseType
32 |
33 | public static var `default`: PinyinOutputFormat {
34 | return PinyinOutputFormat(toneType: .none, vCharType: .vCharacter, caseType: .lowercased)
35 | }
36 |
37 | public init(toneType: PinyinToneType, vCharType: PinyinVCharType, caseType: PinyinCaseType) {
38 | self.toneType = toneType
39 | self.vCharType = vCharType
40 | self.caseType = caseType
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Teambition
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/HanziPinyinExample/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/HanziPinyin/PinyinFormatter.swift:
--------------------------------------------------------------------------------
1 | //
2 | // PinyinFormatter.swift
3 | // HanziPinyin
4 | //
5 | // Created by Xin Hong on 16/4/16.
6 | // Copyright © 2016年 Teambition. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | internal struct PinyinFormatter {
12 | internal static func format(_ pinyin: String, withOutputFormat format: PinyinOutputFormat) -> String {
13 | var formattedPinyin = pinyin
14 |
15 | switch format.toneType {
16 | case .none:
17 | formattedPinyin = formattedPinyin.replacingOccurrences(of: "[1-5]", with: "", options: .regularExpression, range: formattedPinyin.startIndex..
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 10
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/HanziPinyinExample/ActivityButton.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ActivityButton.swift
3 | // HanziPinyinExample
4 | //
5 | // Created by Xin Hong on 16/4/16.
6 | // Copyright © 2016年 Teambition. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ActivityButton: UIButton {
12 | fileprivate lazy var activityIndicator: UIActivityIndicatorView = { [unowned self] in
13 | let activityIndicator = UIActivityIndicatorView(style: .white)
14 | return activityIndicator
15 | }()
16 | fileprivate var title: String?
17 |
18 | override func awakeFromNib() {
19 | addSubview(activityIndicator)
20 | activityIndicator.translatesAutoresizingMaskIntoConstraints = false
21 |
22 | addConstraint(NSLayoutConstraint(item: activityIndicator, attribute: .centerX, relatedBy: .equal, toItem: self, attribute: .centerX, multiplier: 1, constant: 0))
23 | addConstraint(NSLayoutConstraint(item: activityIndicator, attribute: .centerY, relatedBy: .equal, toItem: self, attribute: .centerY, multiplier: 1, constant: 0))
24 | }
25 |
26 | override var isEnabled: Bool {
27 | didSet {
28 | if isEnabled {
29 | backgroundColor = UIColor(red: 3 / 255, green: 169 / 255, blue: 244 / 255, alpha: 1)
30 | } else {
31 | backgroundColor = UIColor(white: 189 / 255, alpha: 1)
32 | }
33 | }
34 | }
35 |
36 | func startAnimating() {
37 | title = titleLabel?.text
38 | setTitle(nil, for: .normal)
39 | activityIndicator.startAnimating()
40 | }
41 |
42 | func stopAnimating() {
43 | activityIndicator.stopAnimating()
44 | setTitle(title, for: .normal)
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 | Carthage/
9 |
10 | ## Various settings
11 | *.pbxuser
12 | !default.pbxuser
13 | *.mode1v3
14 | !default.mode1v3
15 | *.mode2v3
16 | !default.mode2v3
17 | *.perspectivev3
18 | !default.perspectivev3
19 | xcuserdata/
20 |
21 | ## Other
22 | *.moved-aside
23 | *.xccheckout
24 | *.xcscmblueprint
25 |
26 | ## Obj-C/Swift specific
27 | *.hmap
28 | *.ipa
29 | *.dSYM.zip
30 | *.dSYM
31 |
32 | ## Playgrounds
33 | timeline.xctimeline
34 | playground.xcworkspace
35 |
36 | # Swift Package Manager
37 | #
38 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
39 | # Packages/
40 | # Package.pins
41 | .build/
42 |
43 | # CocoaPods
44 | #
45 | # We recommend against adding the Pods directory to your .gitignore. However
46 | # you should judge for yourself, the pros and cons are mentioned at:
47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
48 | #
49 | # Pods/
50 |
51 | # Carthage
52 | #
53 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
54 | # Carthage/Checkouts
55 |
56 | Carthage/Build
57 |
58 | # fastlane
59 | #
60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
61 | # screenshots whenever they are needed.
62 | # For more information about the recommended setup visit:
63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control
64 |
65 | fastlane/report.xml
66 | fastlane/Preview.html
67 | fastlane/screenshots
68 | fastlane/test_output
69 |
70 |
--------------------------------------------------------------------------------
/HanziPinyin/HanziPinyin.swift:
--------------------------------------------------------------------------------
1 | //
2 | // HanziPinyin.swift
3 | // HanziPinyin
4 | //
5 | // Created by Xin Hong on 16/4/16.
6 | // Copyright © 2016年 Teambition. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | internal struct HanziCodePoint {
12 | static let start: UInt32 = 0x4E00
13 | static let end: UInt32 = 0x9FFF
14 | }
15 |
16 | internal struct HanziPinyin {
17 | internal class WhateverClass { }
18 |
19 | internal static let sharedInstance = HanziPinyin()
20 | internal fileprivate(set) var unicodeToPinyinTable = [String: String]()
21 |
22 | init() {
23 | unicodeToPinyinTable = initializeResource()
24 | }
25 |
26 | internal static func pinyinArray(withCharCodePoint charCodePoint: UInt32, outputFormat: PinyinOutputFormat = .default) -> [String] {
27 | func isValidPinyin(_ pinyin: String) -> Bool {
28 | return pinyin != "(none0)" && pinyin.hasPrefix("(") && pinyin.hasSuffix(")")
29 | }
30 |
31 | let codePointHex = String(format: "%x", charCodePoint).uppercased()
32 | guard let pinyin = HanziPinyin.sharedInstance.unicodeToPinyinTable[codePointHex], isValidPinyin(pinyin) else {
33 | return []
34 | }
35 |
36 | let leftBracketRange = pinyin.range(of: "(")!
37 | let rightBracketRange = pinyin.range(of: ")")!
38 | let processedPinyin = String(pinyin[leftBracketRange.upperBound.. String in
42 | return PinyinFormatter.format(pinyin, withOutputFormat: outputFormat)
43 | }
44 | return formattedPinyinArray
45 | }
46 |
47 | internal static func isHanzi(ofCharCodePoint charCodePoint: UInt32) -> Bool {
48 | return charCodePoint >= HanziCodePoint.start && charCodePoint <= HanziCodePoint.end
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # HanziPinyin
2 | A lightweight Swift library supporting convertion between Chinese(both Simplified and Tranditional) characters and Pinyin.
3 |
4 | 
5 |
6 | ## How To Get Started
7 | ### Carthage
8 | Specify "HanziPinyin" in your ```Cartfile```:
9 | ```ogdl
10 | github "teambition/HanziPinyin"
11 | ```
12 |
13 | ### CocoaPods
14 | Specify "HanziPinyin" in your ```Podfile```:
15 | ```ruby
16 | source 'https://github.com/CocoaPods/Specs.git'
17 | platform :ios, '8.0'
18 | use_frameworks!
19 |
20 | pod 'HanziPinyin'
21 | ```
22 |
23 | ### Usage
24 | #### Pinyin output format
25 | ```swift
26 | // PinyinToneType: none, toneNumber
27 | // PinyinVCharType: vCharacter, uUnicode, uAndColon
28 | // PinyinCaseType: lowercased, uppercased, capitalized
29 | let outputFormat = PinyinOutputFormat(toneType: .none, vCharType: .vCharacter, caseType: .lowercased)
30 | ```
31 | #### Convert to Pinyin synchronously
32 | ```swift
33 | print("我爱中文".toPinyin(withFormat: outputFormat, separator: " "))
34 | // wo ai zhong wen
35 |
36 | print("我愛說中國話".toPinyin(withFormat: outputFormat, separator: " "))
37 | // wo ai shuo zhong guo hua
38 |
39 | print("我爱中文".toPinyinAcronym())
40 | // wazw
41 |
42 | print("I love Chinese.".toPinyin())
43 | // I love Chinese.
44 | ```
45 |
46 | #### Convert to Pinyin asynchronously
47 | ```swift
48 | "我爱中文".toPinyin { (pinyin) in
49 | // do something
50 | }
51 |
52 | "我爱中文".toPinyinAcronym { (pinyin) in
53 | // do something
54 | }
55 | ```
56 |
57 | #### Chinese character detecting
58 | ```swift
59 | print("我爱中文".hasChineseCharacter)
60 | // true
61 | print("I love Chinese.".hasChineseCharacter)
62 | // false
63 | ```
64 |
65 | ## Minimum Requirement
66 | iOS 8.0
67 |
68 | ## Release Notes
69 | * [Release Notes](https://github.com/teambition/HanziPinyin/releases)
70 |
71 | ## License
72 | HanziPinyin is released under the MIT license. See [LICENSE](https://github.com/teambition/HanziPinyin/blob/master/LICENSE.md) for details.
73 |
74 | ## More Info
75 | Have a question? Please [open an issue](https://github.com/teambition/HanziPinyin/issues/new)!
76 |
--------------------------------------------------------------------------------
/HanziPinyinExample/HanziPinyinExampleViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // HanziPinyinExampleViewController.swift
3 | // HanziPinyinExample
4 | //
5 | // Created by Xin Hong on 16/4/16.
6 | // Copyright © 2016年 Teambition. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import HanziPinyin
11 |
12 | class HanziPinyinExampleViewController: UIViewController {
13 | @IBOutlet weak var inputTextField: UITextField!
14 | @IBOutlet weak var outputTextView: UITextView!
15 | @IBOutlet weak var pinyinButton: ActivityButton!
16 |
17 | // MARK: - Life cycle
18 | override func viewDidLoad() {
19 | super.viewDidLoad()
20 | setupUI()
21 | }
22 |
23 | deinit {
24 | NotificationCenter.default.removeObserver(self)
25 | }
26 |
27 | // MARK: - Helper
28 | fileprivate func setupUI() {
29 | navigationItem.title = "HanziPinyin"
30 | inputTextField.returnKeyType = .done
31 | inputTextField.placeholder = "Chinese characters..."
32 | outputTextView.text = nil
33 | inputTextField.delegate = self
34 | pinyinButton.isEnabled = false
35 | NotificationCenter.default.addObserver(self, selector: #selector(inputTextFieldTextChanged(_:)), name: UITextField.textDidChangeNotification, object: inputTextField)
36 | }
37 |
38 | // MARK: - Actions
39 | @IBAction func pinyinButtonTapped(_ sender: UIButton) {
40 | guard let text = inputTextField.text else {
41 | return
42 | }
43 |
44 | inputTextField.resignFirstResponder()
45 | let startTime = Date().timeIntervalSince1970
46 | pinyinButton.startAnimating()
47 | let outputFormat = PinyinOutputFormat(toneType: .none, vCharType: .vCharacter, caseType: .capitalized)
48 | text.toPinyin(withFormat: outputFormat) { (pinyin) in
49 | self.pinyinButton.stopAnimating()
50 | let endTime = NSDate().timeIntervalSince1970
51 | let totalTime = endTime - startTime
52 | self.outputTextView.text = "Total Time:" + "\n" + "\(totalTime) (s)" + "\n\n" + "Pinyin:" + "\n" + pinyin
53 | }
54 | }
55 |
56 | @IBAction func backgroundTapped(_ sender: UIControl) {
57 | UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
58 | }
59 |
60 | @objc func inputTextFieldTextChanged(_ notification: Notification) {
61 | pinyinButton.isEnabled = (inputTextField.text?.count ?? 0) > 0
62 | }
63 | }
64 |
65 | extension HanziPinyinExampleViewController: UITextFieldDelegate {
66 | func textFieldShouldReturn(_ textField: UITextField) -> Bool {
67 | inputTextField.resignFirstResponder()
68 | return true
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/HanziPinyin.xcodeproj/xcshareddata/xcschemes/HanziPinyin.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
46 |
52 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
70 |
71 |
72 |
73 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/HanziPinyin/String+HanziPinyin.swift:
--------------------------------------------------------------------------------
1 | //
2 | // String+HanziPinyin.swift
3 | // HanziPinyin
4 | //
5 | // Created by Xin Hong on 16/4/16.
6 | // Copyright © 2016年 Teambition. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public extension String {
12 | func toPinyin(withFormat outputFormat: PinyinOutputFormat = .default, separator: String = " ") -> String {
13 | var pinyinStrings = [String]()
14 | for unicodeScalar in unicodeScalars {
15 | let charCodePoint = unicodeScalar.value
16 | let pinyinArray = HanziPinyin.pinyinArray(withCharCodePoint: charCodePoint, outputFormat: outputFormat)
17 |
18 | if pinyinArray.count > 0 {
19 | pinyinStrings.append(pinyinArray.first! + separator)
20 | } else {
21 | pinyinStrings.append(String(unicodeScalar))
22 | }
23 | }
24 |
25 | var pinyin = pinyinStrings.joined(separator: "")
26 | if !pinyin.isEmpty && String(pinyin.suffix(from: pinyin.index(pinyin.endIndex, offsetBy: -1))) == separator {
27 | pinyin.remove(at: pinyin.index(pinyin.endIndex, offsetBy: -1))
28 | }
29 |
30 | return pinyin
31 | }
32 |
33 | func toPinyin(withFormat outputFormat: PinyinOutputFormat = .default, separator: String = " ", completion: @escaping ((_ pinyin: String) -> ())) {
34 | DispatchQueue.global(qos: .default).async {
35 | let pinyin = self.toPinyin(withFormat: outputFormat, separator: separator)
36 | DispatchQueue.main.async {
37 | completion(pinyin)
38 | }
39 | }
40 | }
41 |
42 | func toPinyinAcronym(withFormat outputFormat: PinyinOutputFormat = .default, separator: String = "") -> String {
43 | var pinyinStrings = [String]()
44 | for unicodeScalar in unicodeScalars {
45 | let charCodePoint = unicodeScalar.value
46 | let pinyinArray = HanziPinyin.pinyinArray(withCharCodePoint: charCodePoint, outputFormat: outputFormat)
47 |
48 | if pinyinArray.count > 0 {
49 | let acronym = pinyinArray.first!.first!
50 | pinyinStrings.append(String(acronym) + separator)
51 | } else {
52 | pinyinStrings.append(String(unicodeScalar))
53 | }
54 | }
55 |
56 | var pinyinAcronym = pinyinStrings.joined(separator: "")
57 | if !pinyinAcronym.isEmpty && String(pinyinAcronym.suffix(from: pinyinAcronym.index(pinyinAcronym.endIndex, offsetBy: -1))) == separator {
58 | pinyinAcronym.remove(at: pinyinAcronym.index(pinyinAcronym.endIndex, offsetBy: -1))
59 | }
60 |
61 | return pinyinAcronym
62 | }
63 |
64 | func toPinyinAcronym(withFormat outputFormat: PinyinOutputFormat = .default, separator: String = "", completion: @escaping ((_ pinyinAcronym: String) -> ())) {
65 | DispatchQueue.global(qos: .default).async {
66 | let pinyinAcronym = self.toPinyinAcronym(withFormat: outputFormat, separator: separator)
67 | DispatchQueue.main.async {
68 | completion(pinyinAcronym)
69 | }
70 | }
71 | }
72 |
73 | var hasChineseCharacter: Bool {
74 | for unicodeScalar in unicodeScalars {
75 | let charCodePoint = unicodeScalar.value
76 | if HanziPinyin.isHanzi(ofCharCodePoint: charCodePoint) {
77 | return true
78 | }
79 | }
80 | return false
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/HanziPinyinExample.xcodeproj/xcuserdata/hongxin.xcuserdatad/xcschemes/HanziPinyinExample.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/HanziPinyin/HanziPinyinResource.swift:
--------------------------------------------------------------------------------
1 | //
2 | // HanziPinyinResource.swift
3 | // HanziPinyin
4 | //
5 | // Created by Xin Hong on 16/4/16.
6 | // Copyright © 2016年 Teambition. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | private struct CacheKeys {
12 | static let unicodeToPinyin = "HanziPinyin.UnicodeToPinyin"
13 | }
14 |
15 | internal extension HanziPinyin {
16 | private var podResourceBundle: Bundle? {
17 | guard let bundleURL = Bundle(for: WhateverClass.self).url(forResource: "HanziPinyin", withExtension: "bundle") else {
18 | return nil
19 | }
20 | return Bundle(url: bundleURL)
21 | }
22 |
23 | func initializeResource() -> [String: String] {
24 | if let cachedPinyinTable = HanziPinyin.cachedObject(forKey: CacheKeys.unicodeToPinyin) as? [String: String] {
25 | return cachedPinyinTable
26 | } else {
27 | let resourceBundle = podResourceBundle ?? Bundle(for: WhateverClass.self)
28 | guard let resourcePath = resourceBundle.path(forResource: "unicode_to_hanyu_pinyin", ofType: "txt") else {
29 | return [:]
30 | }
31 |
32 | do {
33 | let unicodeToPinyinText = try String(contentsOf: URL(fileURLWithPath: resourcePath))
34 | let textComponents = unicodeToPinyinText.components(separatedBy: "\r\n")
35 |
36 | var pinyinTable = [String: String]()
37 | for pinyin in textComponents {
38 | let components = pinyin.components(separatedBy: .whitespaces)
39 | guard components.count > 1 else {
40 | continue
41 | }
42 | pinyinTable.updateValue(components[1], forKey: components[0])
43 | }
44 |
45 | HanziPinyin.cache(pinyinTable, forKey: CacheKeys.unicodeToPinyin)
46 | return pinyinTable
47 | } catch _ {
48 | return [:]
49 | }
50 | }
51 | }
52 | }
53 |
54 | internal extension HanziPinyin {
55 | fileprivate static var pinYinCachePath: String? {
56 | guard let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first else {
57 | return nil
58 | }
59 |
60 | let pinYinCachePath = NSString(string: documentsPath).appendingPathComponent("PinYinCache")
61 | if !FileManager.default.fileExists(atPath: pinYinCachePath) {
62 | do {
63 | try FileManager.default.createDirectory(atPath: pinYinCachePath, withIntermediateDirectories: true, attributes: nil)
64 | } catch {
65 | print("create pinYin cache path error: \(error)")
66 | return nil
67 | }
68 | }
69 | return pinYinCachePath
70 | }
71 |
72 | fileprivate static func pinYinCachePath(forKey key: String) -> String? {
73 | guard let pinYinCachePath = pinYinCachePath else {
74 | return nil
75 | }
76 | return NSString(string: pinYinCachePath).appendingPathComponent(key)
77 | }
78 |
79 | fileprivate static func cache(_ object: Any, forKey key: String) {
80 | let archivedData = NSKeyedArchiver.archivedData(withRootObject: object)
81 | guard let cachePath = pinYinCachePath(forKey: key) else {
82 | return
83 | }
84 | DispatchQueue.global(qos: .default).async {
85 | do {
86 | try archivedData.write(to: URL(fileURLWithPath: cachePath), options: .atomicWrite)
87 | } catch let error {
88 | print("cache object error: \(error)")
89 | }
90 | }
91 | }
92 |
93 | fileprivate static func cachedObject(forKey key: String) -> Any? {
94 | guard let cachePath = pinYinCachePath(forKey: key) else {
95 | return nil
96 | }
97 | do {
98 | let data = try Data(contentsOf: URL(fileURLWithPath: cachePath), options: [])
99 | return NSKeyedUnarchiver.unarchiveObject(with: data)
100 | } catch _ {
101 | return nil
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/HanziPinyinExample/HanziPinyinExample.playground/timeline.xctimeline:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
14 |
15 |
19 |
20 |
24 |
25 |
29 |
30 |
34 |
35 |
39 |
40 |
44 |
45 |
49 |
50 |
54 |
55 |
59 |
60 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/HanziPinyinExample/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
52 |
53 |
54 |
55 | Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/HanziPinyinExample.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | D313641F1CC86C7700CF6E19 /* HanziPinyin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D313641E1CC86C7700CF6E19 /* HanziPinyin.framework */; };
11 | D31364201CC86C7700CF6E19 /* HanziPinyin.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D313641E1CC86C7700CF6E19 /* HanziPinyin.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
12 | D395A10A1CC243DB00B76FB7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D395A1091CC243DB00B76FB7 /* AppDelegate.swift */; };
13 | D395A10C1CC243DB00B76FB7 /* HanziPinyinExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D395A10B1CC243DB00B76FB7 /* HanziPinyinExampleViewController.swift */; };
14 | D395A10F1CC243DB00B76FB7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D395A10D1CC243DB00B76FB7 /* Main.storyboard */; };
15 | D395A1111CC243DB00B76FB7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D395A1101CC243DB00B76FB7 /* Assets.xcassets */; };
16 | D3A293C11CC7DBD2005843BA /* ActivityButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3A293C01CC7DBD2005843BA /* ActivityButton.swift */; };
17 | /* End PBXBuildFile section */
18 |
19 | /* Begin PBXCopyFilesBuildPhase section */
20 | D31364211CC86C7700CF6E19 /* Embed Frameworks */ = {
21 | isa = PBXCopyFilesBuildPhase;
22 | buildActionMask = 2147483647;
23 | dstPath = "";
24 | dstSubfolderSpec = 10;
25 | files = (
26 | D31364201CC86C7700CF6E19 /* HanziPinyin.framework in Embed Frameworks */,
27 | );
28 | name = "Embed Frameworks";
29 | runOnlyForDeploymentPostprocessing = 0;
30 | };
31 | /* End PBXCopyFilesBuildPhase section */
32 |
33 | /* Begin PBXFileReference section */
34 | D313641E1CC86C7700CF6E19 /* HanziPinyin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = HanziPinyin.framework; path = "/Users/hongxin/Library/Developer/Xcode/DerivedData/HanziPinyin-fcixlcqoqphbqfherglmrblqprcq/Build/Products/Debug-iphonesimulator/HanziPinyin.framework"; sourceTree = ""; };
35 | D395A1061CC243DB00B76FB7 /* HanziPinyinExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HanziPinyinExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
36 | D395A1091CC243DB00B76FB7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
37 | D395A10B1CC243DB00B76FB7 /* HanziPinyinExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HanziPinyinExampleViewController.swift; sourceTree = ""; };
38 | D395A10E1CC243DB00B76FB7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
39 | D395A1101CC243DB00B76FB7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
40 | D395A1151CC243DB00B76FB7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
41 | D3A293C01CC7DBD2005843BA /* ActivityButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActivityButton.swift; sourceTree = ""; };
42 | /* End PBXFileReference section */
43 |
44 | /* Begin PBXFrameworksBuildPhase section */
45 | D395A1031CC243DB00B76FB7 /* Frameworks */ = {
46 | isa = PBXFrameworksBuildPhase;
47 | buildActionMask = 2147483647;
48 | files = (
49 | D313641F1CC86C7700CF6E19 /* HanziPinyin.framework in Frameworks */,
50 | );
51 | runOnlyForDeploymentPostprocessing = 0;
52 | };
53 | /* End PBXFrameworksBuildPhase section */
54 |
55 | /* Begin PBXGroup section */
56 | D395A0FD1CC243DB00B76FB7 = {
57 | isa = PBXGroup;
58 | children = (
59 | D313641E1CC86C7700CF6E19 /* HanziPinyin.framework */,
60 | D395A1081CC243DB00B76FB7 /* HanziPinyinExample */,
61 | D395A1071CC243DB00B76FB7 /* Products */,
62 | );
63 | sourceTree = "";
64 | };
65 | D395A1071CC243DB00B76FB7 /* Products */ = {
66 | isa = PBXGroup;
67 | children = (
68 | D395A1061CC243DB00B76FB7 /* HanziPinyinExample.app */,
69 | );
70 | name = Products;
71 | sourceTree = "";
72 | };
73 | D395A1081CC243DB00B76FB7 /* HanziPinyinExample */ = {
74 | isa = PBXGroup;
75 | children = (
76 | D395A1091CC243DB00B76FB7 /* AppDelegate.swift */,
77 | D3A293C01CC7DBD2005843BA /* ActivityButton.swift */,
78 | D395A10B1CC243DB00B76FB7 /* HanziPinyinExampleViewController.swift */,
79 | D395A10D1CC243DB00B76FB7 /* Main.storyboard */,
80 | D395A1101CC243DB00B76FB7 /* Assets.xcassets */,
81 | D395A1151CC243DB00B76FB7 /* Info.plist */,
82 | );
83 | path = HanziPinyinExample;
84 | sourceTree = "";
85 | };
86 | /* End PBXGroup section */
87 |
88 | /* Begin PBXNativeTarget section */
89 | D395A1051CC243DB00B76FB7 /* HanziPinyinExample */ = {
90 | isa = PBXNativeTarget;
91 | buildConfigurationList = D395A1181CC243DB00B76FB7 /* Build configuration list for PBXNativeTarget "HanziPinyinExample" */;
92 | buildPhases = (
93 | D395A1021CC243DB00B76FB7 /* Sources */,
94 | D395A1031CC243DB00B76FB7 /* Frameworks */,
95 | D395A1041CC243DB00B76FB7 /* Resources */,
96 | D31364211CC86C7700CF6E19 /* Embed Frameworks */,
97 | );
98 | buildRules = (
99 | );
100 | dependencies = (
101 | );
102 | name = HanziPinyinExample;
103 | productName = HanziPinyin;
104 | productReference = D395A1061CC243DB00B76FB7 /* HanziPinyinExample.app */;
105 | productType = "com.apple.product-type.application";
106 | };
107 | /* End PBXNativeTarget section */
108 |
109 | /* Begin PBXProject section */
110 | D395A0FE1CC243DB00B76FB7 /* Project object */ = {
111 | isa = PBXProject;
112 | attributes = {
113 | LastSwiftUpdateCheck = 0730;
114 | LastUpgradeCheck = 1020;
115 | ORGANIZATIONNAME = Teambition;
116 | TargetAttributes = {
117 | D395A1051CC243DB00B76FB7 = {
118 | CreatedOnToolsVersion = 7.3;
119 | LastSwiftMigration = 0900;
120 | };
121 | };
122 | };
123 | buildConfigurationList = D395A1011CC243DB00B76FB7 /* Build configuration list for PBXProject "HanziPinyinExample" */;
124 | compatibilityVersion = "Xcode 3.2";
125 | developmentRegion = en;
126 | hasScannedForEncodings = 0;
127 | knownRegions = (
128 | en,
129 | Base,
130 | );
131 | mainGroup = D395A0FD1CC243DB00B76FB7;
132 | productRefGroup = D395A1071CC243DB00B76FB7 /* Products */;
133 | projectDirPath = "";
134 | projectRoot = "";
135 | targets = (
136 | D395A1051CC243DB00B76FB7 /* HanziPinyinExample */,
137 | );
138 | };
139 | /* End PBXProject section */
140 |
141 | /* Begin PBXResourcesBuildPhase section */
142 | D395A1041CC243DB00B76FB7 /* Resources */ = {
143 | isa = PBXResourcesBuildPhase;
144 | buildActionMask = 2147483647;
145 | files = (
146 | D395A1111CC243DB00B76FB7 /* Assets.xcassets in Resources */,
147 | D395A10F1CC243DB00B76FB7 /* Main.storyboard in Resources */,
148 | );
149 | runOnlyForDeploymentPostprocessing = 0;
150 | };
151 | /* End PBXResourcesBuildPhase section */
152 |
153 | /* Begin PBXSourcesBuildPhase section */
154 | D395A1021CC243DB00B76FB7 /* Sources */ = {
155 | isa = PBXSourcesBuildPhase;
156 | buildActionMask = 2147483647;
157 | files = (
158 | D395A10C1CC243DB00B76FB7 /* HanziPinyinExampleViewController.swift in Sources */,
159 | D395A10A1CC243DB00B76FB7 /* AppDelegate.swift in Sources */,
160 | D3A293C11CC7DBD2005843BA /* ActivityButton.swift in Sources */,
161 | );
162 | runOnlyForDeploymentPostprocessing = 0;
163 | };
164 | /* End PBXSourcesBuildPhase section */
165 |
166 | /* Begin PBXVariantGroup section */
167 | D395A10D1CC243DB00B76FB7 /* Main.storyboard */ = {
168 | isa = PBXVariantGroup;
169 | children = (
170 | D395A10E1CC243DB00B76FB7 /* Base */,
171 | );
172 | name = Main.storyboard;
173 | sourceTree = "";
174 | };
175 | /* End PBXVariantGroup section */
176 |
177 | /* Begin XCBuildConfiguration section */
178 | D395A1161CC243DB00B76FB7 /* Debug */ = {
179 | isa = XCBuildConfiguration;
180 | buildSettings = {
181 | ALWAYS_SEARCH_USER_PATHS = NO;
182 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
183 | CLANG_ANALYZER_NONNULL = YES;
184 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
185 | CLANG_CXX_LIBRARY = "libc++";
186 | CLANG_ENABLE_MODULES = YES;
187 | CLANG_ENABLE_OBJC_ARC = YES;
188 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
189 | CLANG_WARN_BOOL_CONVERSION = YES;
190 | CLANG_WARN_COMMA = YES;
191 | CLANG_WARN_CONSTANT_CONVERSION = YES;
192 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
193 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
194 | CLANG_WARN_EMPTY_BODY = YES;
195 | CLANG_WARN_ENUM_CONVERSION = YES;
196 | CLANG_WARN_INFINITE_RECURSION = YES;
197 | CLANG_WARN_INT_CONVERSION = YES;
198 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
199 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
200 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
201 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
202 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
203 | CLANG_WARN_STRICT_PROTOTYPES = YES;
204 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
205 | CLANG_WARN_UNREACHABLE_CODE = YES;
206 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
207 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
208 | COPY_PHASE_STRIP = NO;
209 | DEBUG_INFORMATION_FORMAT = dwarf;
210 | ENABLE_STRICT_OBJC_MSGSEND = YES;
211 | ENABLE_TESTABILITY = YES;
212 | GCC_C_LANGUAGE_STANDARD = gnu99;
213 | GCC_DYNAMIC_NO_PIC = NO;
214 | GCC_NO_COMMON_BLOCKS = YES;
215 | GCC_OPTIMIZATION_LEVEL = 0;
216 | GCC_PREPROCESSOR_DEFINITIONS = (
217 | "DEBUG=1",
218 | "$(inherited)",
219 | );
220 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
221 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
222 | GCC_WARN_UNDECLARED_SELECTOR = YES;
223 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
224 | GCC_WARN_UNUSED_FUNCTION = YES;
225 | GCC_WARN_UNUSED_VARIABLE = YES;
226 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
227 | MTL_ENABLE_DEBUG_INFO = YES;
228 | ONLY_ACTIVE_ARCH = YES;
229 | SDKROOT = iphoneos;
230 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
231 | TARGETED_DEVICE_FAMILY = "1,2";
232 | };
233 | name = Debug;
234 | };
235 | D395A1171CC243DB00B76FB7 /* Release */ = {
236 | isa = XCBuildConfiguration;
237 | buildSettings = {
238 | ALWAYS_SEARCH_USER_PATHS = NO;
239 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
240 | CLANG_ANALYZER_NONNULL = YES;
241 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
242 | CLANG_CXX_LIBRARY = "libc++";
243 | CLANG_ENABLE_MODULES = YES;
244 | CLANG_ENABLE_OBJC_ARC = YES;
245 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
246 | CLANG_WARN_BOOL_CONVERSION = YES;
247 | CLANG_WARN_COMMA = YES;
248 | CLANG_WARN_CONSTANT_CONVERSION = YES;
249 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
250 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
251 | CLANG_WARN_EMPTY_BODY = YES;
252 | CLANG_WARN_ENUM_CONVERSION = YES;
253 | CLANG_WARN_INFINITE_RECURSION = YES;
254 | CLANG_WARN_INT_CONVERSION = YES;
255 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
256 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
257 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
259 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
260 | CLANG_WARN_STRICT_PROTOTYPES = YES;
261 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
262 | CLANG_WARN_UNREACHABLE_CODE = YES;
263 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
264 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
265 | COPY_PHASE_STRIP = NO;
266 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
267 | ENABLE_NS_ASSERTIONS = NO;
268 | ENABLE_STRICT_OBJC_MSGSEND = YES;
269 | GCC_C_LANGUAGE_STANDARD = gnu99;
270 | GCC_NO_COMMON_BLOCKS = YES;
271 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
272 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
273 | GCC_WARN_UNDECLARED_SELECTOR = YES;
274 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
275 | GCC_WARN_UNUSED_FUNCTION = YES;
276 | GCC_WARN_UNUSED_VARIABLE = YES;
277 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
278 | MTL_ENABLE_DEBUG_INFO = NO;
279 | SDKROOT = iphoneos;
280 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
281 | TARGETED_DEVICE_FAMILY = "1,2";
282 | VALIDATE_PRODUCT = YES;
283 | };
284 | name = Release;
285 | };
286 | D395A1191CC243DB00B76FB7 /* Debug */ = {
287 | isa = XCBuildConfiguration;
288 | buildSettings = {
289 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
290 | INFOPLIST_FILE = "$(SRCROOT)/HanziPinyinExample/Info.plist";
291 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
292 | PRODUCT_BUNDLE_IDENTIFIER = Teambition.HanziPinyinExample;
293 | PRODUCT_NAME = HanziPinyinExample;
294 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
295 | SWIFT_VERSION = 5.0;
296 | };
297 | name = Debug;
298 | };
299 | D395A11A1CC243DB00B76FB7 /* Release */ = {
300 | isa = XCBuildConfiguration;
301 | buildSettings = {
302 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
303 | INFOPLIST_FILE = "$(SRCROOT)/HanziPinyinExample/Info.plist";
304 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
305 | PRODUCT_BUNDLE_IDENTIFIER = Teambition.HanziPinyinExample;
306 | PRODUCT_NAME = HanziPinyinExample;
307 | SWIFT_SWIFT3_OBJC_INFERENCE = Default;
308 | SWIFT_VERSION = 5.0;
309 | };
310 | name = Release;
311 | };
312 | /* End XCBuildConfiguration section */
313 |
314 | /* Begin XCConfigurationList section */
315 | D395A1011CC243DB00B76FB7 /* Build configuration list for PBXProject "HanziPinyinExample" */ = {
316 | isa = XCConfigurationList;
317 | buildConfigurations = (
318 | D395A1161CC243DB00B76FB7 /* Debug */,
319 | D395A1171CC243DB00B76FB7 /* Release */,
320 | );
321 | defaultConfigurationIsVisible = 0;
322 | defaultConfigurationName = Release;
323 | };
324 | D395A1181CC243DB00B76FB7 /* Build configuration list for PBXNativeTarget "HanziPinyinExample" */ = {
325 | isa = XCConfigurationList;
326 | buildConfigurations = (
327 | D395A1191CC243DB00B76FB7 /* Debug */,
328 | D395A11A1CC243DB00B76FB7 /* Release */,
329 | );
330 | defaultConfigurationIsVisible = 0;
331 | defaultConfigurationName = Release;
332 | };
333 | /* End XCConfigurationList section */
334 | };
335 | rootObject = D395A0FE1CC243DB00B76FB7 /* Project object */;
336 | }
337 |
--------------------------------------------------------------------------------
/HanziPinyin.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | D316702A1CC362440065A14D /* String+HanziPinyin.swift in Sources */ = {isa = PBXBuildFile; fileRef = D31670291CC362440065A14D /* String+HanziPinyin.swift */; };
11 | D316702C1CC394FD0065A14D /* PinyinOutputFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = D316702B1CC394FD0065A14D /* PinyinOutputFormat.swift */; };
12 | D31670311CC3B2BC0065A14D /* unicode_to_hanyu_pinyin.txt in Resources */ = {isa = PBXBuildFile; fileRef = D31670301CC3B2BC0065A14D /* unicode_to_hanyu_pinyin.txt */; };
13 | D31670331CC3CD760065A14D /* HanziPinyinResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D31670321CC3CD760065A14D /* HanziPinyinResource.swift */; };
14 | D395A1311CC245C500B76FB7 /* HanziPinyin.swift in Sources */ = {isa = PBXBuildFile; fileRef = D395A1301CC245C500B76FB7 /* HanziPinyin.swift */; };
15 | D3B1E9881CC5232F00836FEF /* PinyinFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3B1E9871CC5232F00836FEF /* PinyinFormatter.swift */; };
16 | /* End PBXBuildFile section */
17 |
18 | /* Begin PBXFileReference section */
19 | D31670291CC362440065A14D /* String+HanziPinyin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+HanziPinyin.swift"; sourceTree = ""; };
20 | D316702B1CC394FD0065A14D /* PinyinOutputFormat.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PinyinOutputFormat.swift; sourceTree = ""; };
21 | D31670301CC3B2BC0065A14D /* unicode_to_hanyu_pinyin.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = unicode_to_hanyu_pinyin.txt; sourceTree = ""; };
22 | D31670321CC3CD760065A14D /* HanziPinyinResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HanziPinyinResource.swift; sourceTree = ""; };
23 | D395A1251CC244BB00B76FB7 /* HanziPinyin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = HanziPinyin.framework; sourceTree = BUILT_PRODUCTS_DIR; };
24 | D395A1301CC245C500B76FB7 /* HanziPinyin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HanziPinyin.swift; sourceTree = ""; };
25 | D395A1331CC2460200B76FB7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
26 | D3B1E9871CC5232F00836FEF /* PinyinFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PinyinFormatter.swift; sourceTree = ""; };
27 | /* End PBXFileReference section */
28 |
29 | /* Begin PBXFrameworksBuildPhase section */
30 | D395A1211CC244BB00B76FB7 /* Frameworks */ = {
31 | isa = PBXFrameworksBuildPhase;
32 | buildActionMask = 2147483647;
33 | files = (
34 | );
35 | runOnlyForDeploymentPostprocessing = 0;
36 | };
37 | /* End PBXFrameworksBuildPhase section */
38 |
39 | /* Begin PBXGroup section */
40 | D316702F1CC3B28E0065A14D /* Resources */ = {
41 | isa = PBXGroup;
42 | children = (
43 | D31670301CC3B2BC0065A14D /* unicode_to_hanyu_pinyin.txt */,
44 | );
45 | name = Resources;
46 | path = HanziPinyin/Resources;
47 | sourceTree = "";
48 | };
49 | D395A11B1CC244BB00B76FB7 = {
50 | isa = PBXGroup;
51 | children = (
52 | D395A1271CC244BB00B76FB7 /* HanziPinyin */,
53 | D316702F1CC3B28E0065A14D /* Resources */,
54 | D395A1321CC245EA00B76FB7 /* Supporting Files */,
55 | D395A1261CC244BB00B76FB7 /* Products */,
56 | );
57 | sourceTree = "";
58 | };
59 | D395A1261CC244BB00B76FB7 /* Products */ = {
60 | isa = PBXGroup;
61 | children = (
62 | D395A1251CC244BB00B76FB7 /* HanziPinyin.framework */,
63 | );
64 | name = Products;
65 | sourceTree = "";
66 | };
67 | D395A1271CC244BB00B76FB7 /* HanziPinyin */ = {
68 | isa = PBXGroup;
69 | children = (
70 | D316702B1CC394FD0065A14D /* PinyinOutputFormat.swift */,
71 | D31670291CC362440065A14D /* String+HanziPinyin.swift */,
72 | D395A1301CC245C500B76FB7 /* HanziPinyin.swift */,
73 | D3B1E9871CC5232F00836FEF /* PinyinFormatter.swift */,
74 | D31670321CC3CD760065A14D /* HanziPinyinResource.swift */,
75 | );
76 | path = HanziPinyin;
77 | sourceTree = "";
78 | };
79 | D395A1321CC245EA00B76FB7 /* Supporting Files */ = {
80 | isa = PBXGroup;
81 | children = (
82 | D395A1331CC2460200B76FB7 /* Info.plist */,
83 | );
84 | name = "Supporting Files";
85 | path = "HanziPinyin/Supporting Files";
86 | sourceTree = "";
87 | };
88 | /* End PBXGroup section */
89 |
90 | /* Begin PBXHeadersBuildPhase section */
91 | D395A1221CC244BB00B76FB7 /* Headers */ = {
92 | isa = PBXHeadersBuildPhase;
93 | buildActionMask = 2147483647;
94 | files = (
95 | );
96 | runOnlyForDeploymentPostprocessing = 0;
97 | };
98 | /* End PBXHeadersBuildPhase section */
99 |
100 | /* Begin PBXNativeTarget section */
101 | D395A1241CC244BB00B76FB7 /* HanziPinyin */ = {
102 | isa = PBXNativeTarget;
103 | buildConfigurationList = D395A12D1CC244BB00B76FB7 /* Build configuration list for PBXNativeTarget "HanziPinyin" */;
104 | buildPhases = (
105 | D395A1201CC244BB00B76FB7 /* Sources */,
106 | D395A1211CC244BB00B76FB7 /* Frameworks */,
107 | D395A1221CC244BB00B76FB7 /* Headers */,
108 | D395A1231CC244BB00B76FB7 /* Resources */,
109 | );
110 | buildRules = (
111 | );
112 | dependencies = (
113 | );
114 | name = HanziPinyin;
115 | productName = HanziPinyin;
116 | productReference = D395A1251CC244BB00B76FB7 /* HanziPinyin.framework */;
117 | productType = "com.apple.product-type.framework";
118 | };
119 | /* End PBXNativeTarget section */
120 |
121 | /* Begin PBXProject section */
122 | D395A11C1CC244BB00B76FB7 /* Project object */ = {
123 | isa = PBXProject;
124 | attributes = {
125 | LastUpgradeCheck = 1020;
126 | ORGANIZATIONNAME = Teambition;
127 | TargetAttributes = {
128 | D395A1241CC244BB00B76FB7 = {
129 | CreatedOnToolsVersion = 7.3;
130 | LastSwiftMigration = 1020;
131 | };
132 | };
133 | };
134 | buildConfigurationList = D395A11F1CC244BB00B76FB7 /* Build configuration list for PBXProject "HanziPinyin" */;
135 | compatibilityVersion = "Xcode 3.2";
136 | developmentRegion = en;
137 | hasScannedForEncodings = 0;
138 | knownRegions = (
139 | en,
140 | Base,
141 | );
142 | mainGroup = D395A11B1CC244BB00B76FB7;
143 | productRefGroup = D395A1261CC244BB00B76FB7 /* Products */;
144 | projectDirPath = "";
145 | projectRoot = "";
146 | targets = (
147 | D395A1241CC244BB00B76FB7 /* HanziPinyin */,
148 | );
149 | };
150 | /* End PBXProject section */
151 |
152 | /* Begin PBXResourcesBuildPhase section */
153 | D395A1231CC244BB00B76FB7 /* Resources */ = {
154 | isa = PBXResourcesBuildPhase;
155 | buildActionMask = 2147483647;
156 | files = (
157 | D31670311CC3B2BC0065A14D /* unicode_to_hanyu_pinyin.txt in Resources */,
158 | );
159 | runOnlyForDeploymentPostprocessing = 0;
160 | };
161 | /* End PBXResourcesBuildPhase section */
162 |
163 | /* Begin PBXSourcesBuildPhase section */
164 | D395A1201CC244BB00B76FB7 /* Sources */ = {
165 | isa = PBXSourcesBuildPhase;
166 | buildActionMask = 2147483647;
167 | files = (
168 | D316702A1CC362440065A14D /* String+HanziPinyin.swift in Sources */,
169 | D31670331CC3CD760065A14D /* HanziPinyinResource.swift in Sources */,
170 | D3B1E9881CC5232F00836FEF /* PinyinFormatter.swift in Sources */,
171 | D395A1311CC245C500B76FB7 /* HanziPinyin.swift in Sources */,
172 | D316702C1CC394FD0065A14D /* PinyinOutputFormat.swift in Sources */,
173 | );
174 | runOnlyForDeploymentPostprocessing = 0;
175 | };
176 | /* End PBXSourcesBuildPhase section */
177 |
178 | /* Begin XCBuildConfiguration section */
179 | D395A12B1CC244BB00B76FB7 /* Debug */ = {
180 | isa = XCBuildConfiguration;
181 | buildSettings = {
182 | ALWAYS_SEARCH_USER_PATHS = NO;
183 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
184 | CLANG_ANALYZER_NONNULL = YES;
185 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
186 | CLANG_CXX_LIBRARY = "libc++";
187 | CLANG_ENABLE_MODULES = YES;
188 | CLANG_ENABLE_OBJC_ARC = YES;
189 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
190 | CLANG_WARN_BOOL_CONVERSION = YES;
191 | CLANG_WARN_COMMA = YES;
192 | CLANG_WARN_CONSTANT_CONVERSION = YES;
193 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
194 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
195 | CLANG_WARN_EMPTY_BODY = YES;
196 | CLANG_WARN_ENUM_CONVERSION = YES;
197 | CLANG_WARN_INFINITE_RECURSION = YES;
198 | CLANG_WARN_INT_CONVERSION = YES;
199 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
200 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
201 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
202 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
203 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
204 | CLANG_WARN_STRICT_PROTOTYPES = YES;
205 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
206 | CLANG_WARN_UNREACHABLE_CODE = YES;
207 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
208 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
209 | COPY_PHASE_STRIP = NO;
210 | CURRENT_PROJECT_VERSION = 1;
211 | DEBUG_INFORMATION_FORMAT = dwarf;
212 | ENABLE_STRICT_OBJC_MSGSEND = YES;
213 | ENABLE_TESTABILITY = YES;
214 | GCC_C_LANGUAGE_STANDARD = gnu99;
215 | GCC_DYNAMIC_NO_PIC = NO;
216 | GCC_NO_COMMON_BLOCKS = YES;
217 | GCC_OPTIMIZATION_LEVEL = 0;
218 | GCC_PREPROCESSOR_DEFINITIONS = (
219 | "DEBUG=1",
220 | "$(inherited)",
221 | );
222 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
223 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
224 | GCC_WARN_UNDECLARED_SELECTOR = YES;
225 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
226 | GCC_WARN_UNUSED_FUNCTION = YES;
227 | GCC_WARN_UNUSED_VARIABLE = YES;
228 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
229 | MTL_ENABLE_DEBUG_INFO = YES;
230 | ONLY_ACTIVE_ARCH = YES;
231 | SDKROOT = iphoneos;
232 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
233 | TARGETED_DEVICE_FAMILY = "1,2";
234 | VERSIONING_SYSTEM = "apple-generic";
235 | VERSION_INFO_PREFIX = "";
236 | };
237 | name = Debug;
238 | };
239 | D395A12C1CC244BB00B76FB7 /* Release */ = {
240 | isa = XCBuildConfiguration;
241 | buildSettings = {
242 | ALWAYS_SEARCH_USER_PATHS = NO;
243 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
244 | CLANG_ANALYZER_NONNULL = YES;
245 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
246 | CLANG_CXX_LIBRARY = "libc++";
247 | CLANG_ENABLE_MODULES = YES;
248 | CLANG_ENABLE_OBJC_ARC = YES;
249 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
250 | CLANG_WARN_BOOL_CONVERSION = YES;
251 | CLANG_WARN_COMMA = YES;
252 | CLANG_WARN_CONSTANT_CONVERSION = YES;
253 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
254 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
255 | CLANG_WARN_EMPTY_BODY = YES;
256 | CLANG_WARN_ENUM_CONVERSION = YES;
257 | CLANG_WARN_INFINITE_RECURSION = YES;
258 | CLANG_WARN_INT_CONVERSION = YES;
259 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
260 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
261 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
262 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
263 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
264 | CLANG_WARN_STRICT_PROTOTYPES = YES;
265 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
266 | CLANG_WARN_UNREACHABLE_CODE = YES;
267 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
268 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
269 | COPY_PHASE_STRIP = NO;
270 | CURRENT_PROJECT_VERSION = 1;
271 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
272 | ENABLE_NS_ASSERTIONS = NO;
273 | ENABLE_STRICT_OBJC_MSGSEND = YES;
274 | GCC_C_LANGUAGE_STANDARD = gnu99;
275 | GCC_NO_COMMON_BLOCKS = YES;
276 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
277 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
278 | GCC_WARN_UNDECLARED_SELECTOR = YES;
279 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
280 | GCC_WARN_UNUSED_FUNCTION = YES;
281 | GCC_WARN_UNUSED_VARIABLE = YES;
282 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
283 | MTL_ENABLE_DEBUG_INFO = NO;
284 | SDKROOT = iphoneos;
285 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
286 | TARGETED_DEVICE_FAMILY = "1,2";
287 | VALIDATE_PRODUCT = YES;
288 | VERSIONING_SYSTEM = "apple-generic";
289 | VERSION_INFO_PREFIX = "";
290 | };
291 | name = Release;
292 | };
293 | D395A12E1CC244BB00B76FB7 /* Debug */ = {
294 | isa = XCBuildConfiguration;
295 | buildSettings = {
296 | APPLICATION_EXTENSION_API_ONLY = YES;
297 | CLANG_ENABLE_MODULES = YES;
298 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
299 | DEFINES_MODULE = YES;
300 | DYLIB_COMPATIBILITY_VERSION = 1;
301 | DYLIB_CURRENT_VERSION = 1;
302 | DYLIB_INSTALL_NAME_BASE = "@rpath";
303 | INFOPLIST_FILE = "$(SRCROOT)/HanziPinyin/Supporting Files/Info.plist";
304 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
305 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
306 | PRODUCT_BUNDLE_IDENTIFIER = Teambition.HanziPinyin;
307 | PRODUCT_NAME = "$(TARGET_NAME)";
308 | SKIP_INSTALL = YES;
309 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
310 | SWIFT_VERSION = 5.0;
311 | };
312 | name = Debug;
313 | };
314 | D395A12F1CC244BB00B76FB7 /* Release */ = {
315 | isa = XCBuildConfiguration;
316 | buildSettings = {
317 | APPLICATION_EXTENSION_API_ONLY = YES;
318 | CLANG_ENABLE_MODULES = YES;
319 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
320 | DEFINES_MODULE = YES;
321 | DYLIB_COMPATIBILITY_VERSION = 1;
322 | DYLIB_CURRENT_VERSION = 1;
323 | DYLIB_INSTALL_NAME_BASE = "@rpath";
324 | INFOPLIST_FILE = "$(SRCROOT)/HanziPinyin/Supporting Files/Info.plist";
325 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
326 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
327 | PRODUCT_BUNDLE_IDENTIFIER = Teambition.HanziPinyin;
328 | PRODUCT_NAME = "$(TARGET_NAME)";
329 | SKIP_INSTALL = YES;
330 | SWIFT_VERSION = 5.0;
331 | };
332 | name = Release;
333 | };
334 | /* End XCBuildConfiguration section */
335 |
336 | /* Begin XCConfigurationList section */
337 | D395A11F1CC244BB00B76FB7 /* Build configuration list for PBXProject "HanziPinyin" */ = {
338 | isa = XCConfigurationList;
339 | buildConfigurations = (
340 | D395A12B1CC244BB00B76FB7 /* Debug */,
341 | D395A12C1CC244BB00B76FB7 /* Release */,
342 | );
343 | defaultConfigurationIsVisible = 0;
344 | defaultConfigurationName = Release;
345 | };
346 | D395A12D1CC244BB00B76FB7 /* Build configuration list for PBXNativeTarget "HanziPinyin" */ = {
347 | isa = XCConfigurationList;
348 | buildConfigurations = (
349 | D395A12E1CC244BB00B76FB7 /* Debug */,
350 | D395A12F1CC244BB00B76FB7 /* Release */,
351 | );
352 | defaultConfigurationIsVisible = 0;
353 | defaultConfigurationName = Release;
354 | };
355 | /* End XCConfigurationList section */
356 | };
357 | rootObject = D395A11C1CC244BB00B76FB7 /* Project object */;
358 | }
359 |
--------------------------------------------------------------------------------