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
enum Command: String { | |
case Command1, Command2 | |
} | |
func main(args: [String]) { | |
guard let arg1 = args.first, | |
command = Command(rawValue: arg1.capitalizedString) else { | |
// Maybe it would be a good thing to print some help... | |
return | |
} |
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
class NetworkController { | |
// To simplify getSomeDataFromNetwork() send request synchronously | |
// and return a value on success, .None on failure. | |
func getSomeDataFromNetwork() -> AnyObject? {} | |
} | |
struct ViewModel { | |
var networkController: NetworkController |
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
class NetworkController { | |
// To simplify getSomeDataFromNetwork() send request synchronously | |
// and return a value on success, .None on failure. | |
func getSomeDataFromNetwork() -> AnyObject? {} | |
} | |
struct ViewModel { | |
var networkController: NetworkController |
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
// DrawingView by Clément Cyril - @clmntcrl - http://clmntcrl.io/ | |
// Copyright 2015 Clément Cyril. | |
import UIKit | |
class DrawingView: UIView { | |
var draw: CGRect -> Void = { _ in } { | |
didSet { setNeedsDisplay() } | |
} |
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
// LocalizedString by Clément Cyril - @clmntcrl - http://clmntcrl.io/ | |
// Copyright 2015 Clément Cyril. | |
import Foundation | |
func localizedString(string: String, comment: String = "") -> String { | |
return String(NSLocalizedString(string, comment: comment)) | |
} |
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
// FileLineStream by Clément Cyril - @clmntcrl - http://clmntcrl.io/ | |
// Copyright 2015 Clément Cyril. | |
import Foundation | |
final class FileLineStream: GeneratorType { | |
typealias Element = String | |
private var fileHandle: NSFileHandle? |
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
enum EchoComponent { | |
case Datetime(format: String) | |
case Flag(flags: [EchoLevel: EchoFlag]) | |
case Filename | |
case Function | |
case Line | |
case Message | |
case Separator(String) | |
} |
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
enum EchoComponent { | |
case Datetime | |
case Flag | |
case Filename | |
case Function | |
case Line | |
case Message | |
case Separator(String) | |
} |
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
enum EchoComponent { | |
case DateTime | |
case Flag | |
case Filename | |
case Function | |
case Line | |
case Message | |
} | |
extension EchoComponent: Printable { | |
public var description: String { |
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
struct Echo { | |
var format = "[flag] [[datetime]] [[filename]:[line]] [message]" | |
} |
NewerOlder