The project wraps SwiftyOpenCC by ddddxxx into a CocoaPods spec. You can use Swift Package Manager or Carthage to install SwiftyOpenCC, however, it does not provide a CocoaPods spec, and I want to make my own life easier.
To run the example project, clone the repo, and run pod install
from the
Example directory first.
A quick example:
import OpenCC
var bundle: Bundle? = {
let openCCBundle = Bundle(for: ChineseConverter.self)
guard let resourceUrl = openCCBundle.url(forResource: "OpenCCDictionary", withExtension: "bundle") else {
return nil
}
return Bundle(url: resourceUrl)
}()
let str = "鼠标里面的硅二极管坏了,导致光标分辨率降低。"
let converter = try! ChineseConverter(bundle: bundle!, option: [.traditionalize, .TWStandard, .TWIdiom])
converter.convert(str)
// 滑鼠裡面的矽二極體壞了,導致游標解析度降低。
- Latest Xcode
- iOS 11 or above.
- macOS 10.13 or above.
- tvOS 11 or above.
OpenCC is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'OpenCC'
zonble, [email protected]
OpenCC is available under the MIT license. See the LICENSE file for more info.