Swiftpack.co - CrazyFanFan/K3Pinyin as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by CrazyFanFan.
CrazyFanFan/K3Pinyin 2.0.0
translate chinese hanzi to pinyin by swift
⭐️ 11
🕓 2 years ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/CrazyFanFan/K3Pinyin.git", from: "2.0.0")

K3Pinyin

translate chinese hanzi to pinyin by swift

Installation

CocoaPods

To integrate K3Pinyin into your Xcode project using CocoaPods, specify it in your Podfile:

platform :ios, '8.0'

target 'TargetName' do
use_frameworks!
pod 'K3Pinyin', '~> 0.0.2'
end

Then, run the following command:

$ pod install

Usage

simple way

// code
let string = "中国"
print(string.k3.pinyin)
print(string.k3.pinyin(nil))
string.k3.pinyin(nil) { (pinyin) in
    print(pinyin)
}


// result
zhōngguó
zhōngguó
zhōngguó

option

print(string.k3.pinyin([.stripCombiningMarks,
                        .separator(""),
                        .onlyFirstCharacter,
                        .allFirstLetter,
                        .capitalized]))

Z

Issues

  • Polyphone

Author

Crazy凡, [email protected]

License

K3Pinyin is released under the MIT license. See LICENSE for details.

GitHub

link
Stars: 11
Last commit: 5 days ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

K3Pinyin 2.0.0
3 years ago

For Xcode 12 / Swift 5.3

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics