Original article: https://medium.com/@tomaspueyo/coronavirus-act-today-or-people-will-die-f4d3d9cd99ca
This file contains 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
import Foundation | |
import CoreData | |
extension NSFetchRequest { | |
func withPredicate(format: String, arguments: [AnyObject]? = nil) -> NSFetchRequest { | |
return withPredicate(NSPredicate(format: format, argumentArray: arguments)) | |
} | |
func andPredicate(format: String, arguments: [AnyObject]? = nil) -> NSFetchRequest { |
This file contains 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
import Foundation | |
enum NSDataError: ErrorType { | |
case OutOfBounds(data: NSData) | |
case InvalidASCIIString(data: NSData) | |
case ValueDoesNotMatchEnum(value: UInt8, type: Any) | |
} | |
// MARK: - NSData CollectionType conformance | |
extension NSData: CollectionType { |
This file contains 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
import UIKit | |
extension UIColor { | |
static func colorWithHexValue(hexValue: UInt32, alpha: CGFloat) -> UIColor { | |
let red = CGFloat((hexValue & 0xFF0000) >> 16) | |
let green = CGFloat((hexValue & 0x00FF00) >> 8) | |
let blue = CGFloat((hexValue & 0x0000FF)) | |
return UIColor(red: red/255.0, green: green/255.0, blue: blue/255.0, alpha: alpha) | |
} |
This file contains 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
import UIKit | |
protocol CollectionViewCellConfigurable { | |
typealias ItemType | |
typealias CellType: UICollectionViewCell | |
static func reuseIdentifierForIndexPath(indexPath: NSIndexPath) -> String | |
static func configureCellAtIndexPath(indexPath: NSIndexPath, item: ItemType, cell: CellType) | |
} |