Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hongxinhope committed Apr 21, 2016
1 parent 16d6798 commit 2112373
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
Binary file added Gif/HanziPinyinExample.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#HanziPinyin
A lightweight Swift library supporting convertion between Chinese(both Simplified and Tranditional) characters and Pinyin.

![Example](Gif/HanziPinyinExample.gif "HanziPinyinExample")

##How To Get Started
###Carthage
Specify "HanziPinyin" in your ```Cartfile```:
```ogdl
github "teambition/HanziPinyin"
```

###Usage
##### Pinyin output format
```swift
// PinyinToneType: None, ToneNumber
// PinyinVCharType: VCharacter, UUnicode, UAndColon
// PinyinCaseType: Lowercase, Uppercase
let outputFormat = PinyinOutputFormat(toneType: .None, vCharType: .VCharacter, caseType: .Lowercase)
```
##### Convert to Pinyin synchronously
```swift
print("我爱中文".toPinyin(withFormat: outputFormat, separator: " "))
// wo ai zhong wen

print("我愛說中國話".toPinyin(withFormat: outputFormat, separator: " "))
// wo ai shuo zhong guo hua

print("我爱中文".toPinyinAcronym())
// wazw

print("I love Chinese.".toPinyin())
// I love Chinese.
```

##### Convert to Pinyin asynchronously
```swift
"我爱中文".toPinyin { (pinyin) in
// do something
}

"我爱中文".toPinyinAcronym { (pinyin) in
// do something
}
```

##### Chinese character detecting
```swift
print("我爱中文".hasChineseCharacter())
// true
print("I love Chinese.".hasChineseCharacter())
// false
```

## Minimum Requirement
iOS 8.0

## Release Notes
* [Release Notes](https://github.com/teambition/HanziPinyin/releases)

## License
HanziPinyin is released under the MIT license. See [LICENSE](https://github.com/teambition/HanziPinyin/blob/master/LICENSE.md) for details.

## More Info
Have a question? Please [open an issue](https://github.com/teambition/HanziPinyin/issues/new)!

0 comments on commit 2112373

Please sign in to comment.