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 Shape { | |
case Rectangle(width: Int, height: Int) | |
case Circle(radius: Int) | |
} |
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
func listMessages(completion: (messages: [Message]?, error: NSError?) -> Void) { | |
// Get the list of messages | |
// If success, call completion(messages: messages, error: nil) | |
// If error, call completion(messages: nil, error: error) | |
} |
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 Message { | |
let text: String | |
let status: Status | |
} |
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 Message { | |
let text: String | |
let status: Status | |
init?(dictionary: NSDictionary) { | |
guard | |
let text = dictionary["text"] as? String, | |
let statusString = dictionary["status"] as? String, | |
let status = Status(rawValue: statusString) | |
else { return nil } |
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 Status: String { | |
case Draft = "draft" | |
case Sent = "sent" | |
case Failed = "failed" | |
} |
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 Side: String { | |
case Top | |
case Left | |
case Bottom | |
case Right | |
} |
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 Side: Int { | |
case Top | |
case Left | |
case Bottom | |
case Right | |
} |
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 Side { | |
case Top | |
case Left | |
case Bottom | |
case Right | |
} |
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
guard | |
let htmlPath = NSBundle.mainBundle().pathForResource("LICENSES", ofType: "html"), | |
let html = try? String(contentsOfFile: htmlPath, encoding: NSUTF8StringEncoding) | |
else { | |
fatalError("LICENSES.html not found.") | |
} | |
let webView = WKWebView(frame: CGRectZero, configuration: WKWebViewConfiguration()) | |
webView.loadHTMLString(html, baseURL: nil) |
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
#!/usr/bin/env xcrun swift -F Carthage/Build/Mac | |
import Foundation | |
import Markingbird | |
protocol Streamable { | |
var title: String { get } | |
var body: String { get } | |
} |