Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yockow/swiftunicodesupplement
Unicode Supplement for Swift.
https://github.com/yockow/swiftunicodesupplement
swift unicode
Last synced: 24 days ago
JSON representation
Unicode Supplement for Swift.
- Host: GitHub
- URL: https://github.com/yockow/swiftunicodesupplement
- Owner: YOCKOW
- License: other
- Created: 2018-06-22T01:37:52.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-09-24T03:40:53.000Z (about 1 year ago)
- Last Synced: 2023-09-24T11:36:31.583Z (about 1 year ago)
- Topics: swift, unicode
- Language: Swift
- Homepage:
- Size: 6.21 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# What is `SwiftUnicodeSupplement`?
`SwiftUnicodeSupplement` adds some additional functions to `Unicode(.Scalar)`.
Although [SE-0211](https://github.com/apple/swift-evolution/blob/master/proposals/0211-unicode-scalar-properties.md) is already implemented in Swift 5.0,
some features (such as `IDNAStatus`) implemented in this library may be useful.# Requirements
- Swift 5, 6 (including language mode for Swift 4 or 4.2)
- macOS or Linux# Usage
```Swift
import UnicodeSupplementlet a: Unicode.Scalar = "a"
print(a.latestProperties.bidiClass == .leftToRight)
// -> trueprint(a.latestProperties.canonicalCombiningClass == .notReordered)
// -> trueprint(a.latestProperties.isMath)
// -> falseprint(a.latestProperties.isAlphabetic)
// -> trueprint(a.latestProperties.generalCategory == .lowercaseLetter)
// -> trueprint(a.latestProperties.joiningGroup == .noJoiningGroup)
// -> trueprint(a.latestProperties.joiningType == .nonJoining)
// -> trueprint(a.latestProperties.script == .latin)
// -> trueprint(a.latestProperties.isWhitespace)
// -> falseprint(a.latestProperties.isASCIIHexDigit)
// -> true
```# Update
You can run `./utils/update` to update properties.
# License
MIT License.
See "LICENSE.txt" for more information.