Skip to content

Instantly share code, notes, and snippets.

View miguellara's full-sized avatar
🥑

Miguel Lara Encabo miguellara

🥑
View GitHub Profile
@miguellara
miguellara / UIViewAnimationCurve-to-UIViewAnimationOptions.swift
Created November 20, 2015 22:55
UIViewAnimationCurve to UIViewAnimationOptions
import UIKit
func viewAnimationOptionForCurve(curve: UIViewAnimationCurve) -> UIViewAnimationOptions {
switch (curve) {
case .EaseInOut:
return UIViewAnimationOptions.CurveEaseInOut
case .EaseIn:
return UIViewAnimationOptions.CurveEaseIn
case .EaseOut:
return UIViewAnimationOptions.CurveEaseOut
@miguellara
miguellara / NSTimer+Block.swift
Created November 20, 2015 06:19
NSTimer Block Extension
import Foundation
extension NSTimer {
class func scheduledTimerWithTimeInterval(
timeInterval: NSTimeInterval, userInfo: AnyObject?, repeats: Bool, block: (timer: NSTimer) -> Void) -> NSTimer
{
let minion = TimerBlock(block: block)
// The `minion` will be retained by the `NSTimer` as its `target`, until the timer is invalidated.
@miguellara
miguellara / NSDate+Comparable.swift
Created November 16, 2015 15:55
Comparing NSDate
import Foundation
// MARK: - Extension
extension NSDate: Comparable {}
public func <(lhs: NSDate, rhs: NSDate) -> Bool {
return lhs.timeIntervalSinceReferenceDate < rhs.timeIntervalSinceReferenceDate
}
public func <=(lhs: NSDate, rhs: NSDate) -> Bool {