Giter Site home page Giter Site logo

formulastyledate's Introduction

FormulaStyleDate

GitHub license Carthage compatible GitHub version build passing

Formula-style NSDate calculation framework for Swift.

Code Examples

import Foundation
import FormulaStyleDate

let now = NSDate()
let before = now.dateByAddingTimeInterval(-60.0)
let after = now.dateByAddingTimeInterval(60.0)

now + 60.0 == after  // => true
60.0 + now == after  // => true

now - 60.0 == before // => true
now - before == 60.0 // => true

now < before // => false
now < after // => true

now > before // => true
now > after // => false

now <= before // => false
now <= now // => true
now <= after // => true

now >= before // => true
now >= now // => true
now >= after // => false

Please refer to the code for the test case, too.

Requirements

  • Swift 1.2 (Xcode 6.3 or later)
  • iOS 8 or later (by Carthage) / iOS 7 (by coping the source files directly)

Installation

There are two options.

Using Carthage (iOS 8 or later)

Using Carthage, it's easy to add FormulaStyleDate to the project.

  • Add github "fhisa/FormulaStyleDate" to your Cartfile.
  • Run carthage update
  • Add FormulaStyleDate.framework in Carthage/Build/iOS to your Xcode project.

Copying source files directly (iOS 7)

  • Add this repository as a git submodule:
$ git submodule add https://github.com/fhisa/FormulaStyleDate.git PATH_TO_SUBMODULE
// or
$ carthage update --use-submodules
  • Then just add references of FormulaStyleDate/*.swift to your Xcode project.

TODO

license

FormulaStyleDate is released under the MIT license.

formulastyledate's People

Contributors

fhisa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.