This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIColor | |
{ | |
convenience init(RGBValue:UInt32) | |
{ | |
let red = (RGBValue & 0xFF0000) >> 16 | |
let green = (RGBValue & 0x00FF00) >> 8 | |
let blue = (RGBValue & 0x0000FF) >> 0 | |
self.init(red:CGFloat(red)/255.0,green:CGFloat(green)/255.0,blue:CGFloat(blue)/255.0,alpha:CGFloat(1.0)) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MultilineLabelCloudView.swift | |
// | |
// | |
import UIKit | |
/** | |
Presents a wrapping grid of tokens presented as pills. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Not sure why this generic version does not work. | |
private class WrapperTableViewCell<T:UIView> : UITableViewCell | |
{ | |
class var classReuseIdentifier:String { return T.self.description() + "CellIdentifier" } | |
override class func requiresConstraintBasedLayout() -> Bool { return true } | |
override init(style: UITableViewCellStyle, reuseIdentifier: String?) | |
{ | |
super.init(style: UITableViewCellStyle.Default, reuseIdentifier: reuseIdentifier) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ViewWrappingTableViewCell.swift | |
// Created by Alexis Gallagher on 6/4/15. | |
import UIKit | |
/** | |
Abstract superclass for quickly defining a `UITableViewCell` subclass that wraps a | |
specific `UIView` subclass. The resulting `UITableViewCell` will hug the wrapped view | |
with layout constraints, so that both the cell and the wrapped view can influence |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MARK: Font utilities | |
// | |
enum FontFamily : String { | |
case HelveticaNeue = "Helvetica Neue" | |
case MontSerrat = "Montserrat" | |
} | |
enum FontWeight { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSString+RelativePaths.m | |
#import "NSString+RelativePaths.h" | |
/** | |
Returns a path to resourcePath, relative to anchorPath. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MARK: generic networking and JSON-decoding helper | |
// | |
// give it a NSURLRequest and a session, it gives you back a aresult with an AnyObject or an NSError | |
public class JSONService | |
{ | |
/// returns JSON result on statusCode 200, and an error otherwise | |
public class func taskWithJSONRequest( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private extension NSURLComponents | |
{ | |
func withQueryItem(name:String,intValue:Int) -> NSURLComponents { | |
return self.withQueryItem(name, stringValue: NSNumber(integer: intValue).stringValue) | |
} | |
func withQueryItem(name:String,floatValue:Float) -> NSURLComponents { | |
return self.withQueryItem(name, stringValue: NSNumber(float: floatValue).stringValue) | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// known-good: Xcode 7.3 (Swift 2.2) | |
import Cocoa | |
private var rfc3339formatter:NSDateFormatter = { | |
let formatter = NSDateFormatter() | |
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z" | |
formatter.timeZone = NSTimeZone(forSecondsFromGMT: 0) | |
formatter.calendar = NSCalendar(calendarIdentifier: NSCalendarIdentifierISO8601)! | |
formatter.locale = NSLocale(localeIdentifier: "en_US_POSIX") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swift 1.2 | |
/** | |
:param: old array of items | |
:param: new array of items | |
:return: a tuple where with the following components: | |
- `newIndexesAdded` indexes in new, for elements that did not exist in old | |
- `oldIndexesDeleted` indexes in old, for elements not in new |