From 8730e18bc61b5f46eeb9d59b2ab4acb72cf05375 Mon Sep 17 00:00:00 2001 From: Yasuhiro Hatta Date: Sun, 13 Jan 2019 15:12:42 +0900 Subject: [PATCH] Update README.md --- README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/README.md b/README.md index efd0afb..594c795 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,53 @@ [![Build Status](https://travis-ci.org/yaslab/ULID.swift.svg?branch=master)](https://travis-ci.org/yaslab/ULID.swift) [![codecov](https://codecov.io/gh/yaslab/ULID.swift/branch/master/graph/badge.svg)](https://codecov.io/gh/yaslab/ULID.swift) + +Implementation of [ULID](https://github.com/ulid/spec/blob/master/README.md) in Swift. + +## Usage + +### Generate ULID + +```swift +// Generate ULID using current time +let ulid = ULID() + +// Get ULID string +let string: String = ulid.ulidString +// Get ULID binary data +let data: Data = ulid.ulidData +``` + +### Parse ULID + +```swift +// Parse ULID string +let ulid = ULID(ulidString: "01D0YHEWR9WMPY4NNTPK1MR1TQ") + +// Get Timestamp as Date +let timestamp: Date = ulid.timestamp +``` + +## Installation + +### CocoaPods + +``` +pod 'ULID.swift', '~> 1.0.0' +``` + +### Carthage + +``` +github "yaslab/ULID.swift" ~> 1.0.0 +``` + +### Swift Package Manager + +``` +.package(url: "https://github.com/yaslab/ULID.swift.git", .upToNextMinor(from: "1.0.0")) +``` + +## License + +ULID.swift is released under the MIT license. See the [LICENSE](https://github.com/yaslab/ULID.swift/blob/master/LICENSE) file for more info.