All Projects â†’ SwiftKitz â†’ Datez

SwiftKitz / Datez

Licence: mit
📆 Breeze through Date, DateComponents, and TimeInterval with Swift!

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Datez

Swiftlinkpreview
It makes a preview from an URL, grabbing all the information such as title, relevant texts and images.
Stars: ✭ 1,216 (+378.74%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Sqift
Powerful Swift wrapper for SQLite
Stars: ✭ 119 (-53.15%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Swiftyattributes
A Swifty API for attributed strings
Stars: ✭ 1,303 (+412.99%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Xcglogger
A debug log framework for use in Swift projects. Allows you to log details to the console (and optionally a file), just like you would have with NSLog() or print(), but with additional information, such as the date, function name, filename and line number.
Stars: ✭ 3,710 (+1360.63%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Cdmarkdownkit
An extensive Swift framework providing simple and customizable markdown parsing.
Stars: ✭ 158 (-37.8%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Swiftframeworktemplate
A template for new Swift iOS / macOS / tvOS / watchOS Framework project ready with travis-ci, cocoapods, Carthage, SwiftPM and a Readme file
Stars: ✭ 527 (+107.48%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Swifterswift
A handy collection of more than 500 native Swift extensions to boost your productivity.
Stars: ✭ 10,706 (+4114.96%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Sdwebimagewebpcoder
A WebP coder plugin for SDWebImage, use libwebp
Stars: ✭ 101 (-60.24%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Color
Color utilities for macOS, iOS, tvOS, and watchOS
Stars: ✭ 145 (-42.91%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Ducttape
📦 KeyPath dynamicMemberLookup based syntax sugar for Swift.
Stars: ✭ 138 (-45.67%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Functionkit
A framework for functional types and operations designed to fit naturally into Swift.
Stars: ✭ 302 (+18.9%)
Mutual labels:  tvos, watchos, cocoapods, carthage
L10n Swift
Localization of the application with ability to change language "on the fly" and support for plural form in any language.
Stars: ✭ 177 (-30.31%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Web3.swift
A pure swift Ethereum Web3 library
Stars: ✭ 295 (+16.14%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Guitar
A Cross-Platform String and Regular Expression Library written in Swift.
Stars: ✭ 641 (+152.36%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Contentful.swift
A delightful Swift interface to Contentful's content delivery API.
Stars: ✭ 132 (-48.03%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Cocoalumberjack
A fast & simple, yet powerful & flexible logging framework for Mac and iOS
Stars: ✭ 12,584 (+4854.33%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Iso8601
ISO8601 date parser and writer
Stars: ✭ 213 (-16.14%)
Mutual labels:  tvos, watchos, cocoapods, carthage
Period
PHP's time range API
Stars: ✭ 616 (+142.52%)
Mutual labels:  date, datetime, calendar
Angular Moment Picker
Angular Moment Picker is an AngularJS directive for date and time picker using Moment.js.
Stars: ✭ 536 (+111.02%)
Mutual labels:  date, datetime, calendar
Laydate
layDate(日期与时间组件) 是 layui 独立维护的三大组件之一
Stars: ✭ 1,066 (+319.69%)
Mutual labels:  date, datetime, calendar

Datez 📆

Breeze through Date, DateComponents, and TimeInterval

Version Version Swift Platforms

Highlights

  • Two Custom Structs Only (value types FTW!):

    • DateView: An Date associated with an Calendar
    • CalendarComponents: Like DateComponents, but Calendar agnostic.
  • Absolutely Zero Hardcode:
    Only hardcode now is to clear the date components, by setting the value to 0 or 1. Nothing like:
    minutes = seconds * 60.

  • Modular Composition Design:
    Only one way to achieve something, instead of copy pasting code everywhere, with tons of head scratching.

Features

You can try them in the playground shipped with the framework!

Quickly and Explicitly Access Date Components:

let someDate = Date()
let currentCalendar = someDate.currentCalendar.components.year
let gregorianDay = someDate.gregorian.components.day
let hijriMonth = someDate.islamicCivil.components.month

Easy and Concise Date Manipulation:

let date = Date()
let gregorianDate = date.gregorian

// Adding components
let tomorrow = gregorianDate + 1.day

// Relative accessors
let firstThingTomorrow = tomorrow.beginningOfDay

// Easy tweaking
let firstThingTomorrowButIn1984 = firstThingTomorrow.update(year: 1984)

// now, lets get the date
let newDate = firstThingTomorrowButIn1984.date

Convenient Date Operators:

// Just calling timeIntervalSinceDate
let difference = Date(timeIntervalSinceNow: 5.minutes.timeInterval) - Date()

// Just calling dateByAddingTimeInterval
let afterFiftyHours = Date() + 50.hours.timeInterval

// Just calling compare:
let compareResult = Date(timeIntervalSinceNow: 8.hours.timeInterval) < Date()

[Bonus]: Durations
This is marked as bonus since it's not ideal at all for precise calculation, but super useful when you just need some convenience. Examples would be setting expiration intervals and estimating components from TimeInterval

// Easily access TimeInterval to construct durations
let expirationInterval = 300.days.timeInterval

// Convert back to a single date component
let months = expirationInterval.totalMonths // 9

// Or multiple components
let components = expirationInterval.components
// components ≈ CalendarComponents(day: 6, month: 9)

Getting Started

Swift Package Manager

TODO: Write me

CocoaPods

CocoaPods is fully supported. Simply add the following line to your Podfile:

pod 'Datez'

Submodule

For manual installation, you can grab the source directly or through git submodules, then simply:

  • Drop the Datez.xcodeproj file as a subproject (make sure Copy resources is not enabled)
  • Navigate to your root project settings. Under "Embedded Binaries", click the "+" button and select the Datez.framework

Motivation

This framework doesn't reinvent anything Apple already built. Under the hood, it leverages the Date, Calendar, and DateComponents classes to do all the work. It simply tries to simplify the API for Swift developers. Period.

After experiencing what using a great Swift API feels like, by using RealmSwift and SwiftyJSON, I started to believe in the importance of a clean and concise Swift API, and its impact on our productivity and stress levels.

What's wrong with other date libraries?

Assuming the underlying Calendar:
I needed to explicitly choose between Gregorian and IslamicCivil, so that is integrated.

Wrong Date Calculation:
Most frameworks I've seen make assumptions about the number of days in a month, or hardcode the number of hours ... etc.

Author

Mazyod (@Mazyod)

License

Datez is released under the MIT license. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].