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 | |
public func cast<T>(from any: Any?) -> T { | |
guard let type = any as? T else { | |
fatalError() | |
} | |
return type |
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 | |
public enum Environment: String { | |
// A plist should exist for each of the environments | |
// below. For example `case production = "Prod"` will | |
// have a corresponding `Prod.plist`. | |
case production | |
case staging |
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 | |
extension Decodable { | |
public static func from(data: Data) throws -> Self { | |
return try JSONDecoder() | |
.decode(self, from: data) | |
} | |
} |
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 | |
extension Collection { | |
public var nonEmpty: Self? { | |
guard !self.isEmpty else { | |
return nil | |
} |
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
// | |
// Parallel.swift | |
// | |
import Dispatch | |
extension DispatchQueue { | |
public func parallel(_ blocks: Array<() -> Void>) { | |
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 | |
public struct Regex { | |
private let expression: NSRegularExpression | |
private let pattern: String | |
public init?(pattern _pattern: String) { | |