Latest 1.1.2
Homepage https://github.com/numen31337/Day
License MIT
Platforms ios 9.0, watchos 4.0
Authors

Platform
CocoaPods
Build Status

Day is the mini library to represent a Day value with serialization functionality. Mainly for private use.

Features

  • Can be created from the Date with resetting of its time components
  • Serialization to the human-readable and sortable String and back
  • Caching (for internal usage)
  • Day seeking algorithms (primarily for my personal need)
  • Convenient property for accessing next and previous day
  • Day offset calculations

Usage

Initialising:

let day = Day() //Day value for the current day
let day = Day(date) //Day value from the date by dropping time components

Serialization:

let serializedString = day.serializedDayString //A serialized string value
let day = Day(serializedString) //Day value from the serialized string

Getting a Date value from the Day value:

let date = day.rawValue

Day calculations:

let nextDay = day.nextDay
let previousDay = day.prevDay
let twoDaysBefore = day.dayBy(addingDays: -2)

Difference between two days:

let diff = day.numberOfDays(sinceDay: day1)
let diff = day.numberOfDays(toDate: day1)

Latest podspec

{
    "name": "Day",
    "version": "1.1.2",
    "summary": "Mini lib to represent a Day",
    "description": "This is the mini library to represent a Day value with serialization functionality",
    "homepage": "https://github.com/numen31337/Day",
    "license": "MIT",
    "authors": {
        "Oleksandr Kirichenko": "[email protected]"
    },
    "social_media_url": "http://twitter.com/numen31337",
    "platforms": {
        "ios": "9.0",
        "watchos": "4.0"
    },
    "swift_version": "4.2",
    "source": {
        "git": "https://github.com/numen31337/Day.git",
        "tag": "1.1.2"
    },
    "source_files": "Day/**/*.{h,m,swift}"
}

Pin It on Pinterest

Share This