Swiftpack.co - FormatterKit/DayPeriodFormatter as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by FormatterKit.
FormatterKit/DayPeriodFormatter 0.0.2
A formatter for localized day periods (morning, afternoon, night, etc.)
⭐️ 175
🕓 4 years ago
.package(url: "https://github.com/FormatterKit/DayPeriodFormatter.git", from: "0.0.2")

DayPeriodFormatter

import Foundation
import DayPeriodFormatter

let formatter = DayPeriodFormatter()
let dateComponents = DateComponents(hour: 9, minute: 41)
formatter.string(from: dateComponents) // "morning"

// 150+ locales supported
formatter.locale = Locale(identifier: "ja")
formatter.string(from: dateComponents) // "朝"

Requirements

  • Swift 4.0+

Installation

Swift Package Manager

Add the DayPeriodFormatter package to your target dependencies in Package.swift:

import PackageDescription

let package = Package(
  name: "YourProject",
  dependencies: [
    .package(
        url: "https://github.com/FormatterKit/DayPeriodFormatter",
        from: "0.0.2"
    ),
  ]
)

Then run the swift build command to build your project.

License

MIT

Contact

Mattt (@mattt)

GitHub

link
Stars: 175
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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