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
let google: Provider = .google(clientID: "", clientSecret: "") | |
google.scopes = ["email", "profile"] | |
google.authorize(getCode: { code, url in | |
// prompt user to visit url and enter code | |
}) { result in | |
switch result { | |
case .success(let token): | |
print(token) | |
case .failure(let 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
typealias Result = (value: String?, error: String?) | |
let result = Result("value", nil) | |
switch result { | |
case let (.Some(value), .None): | |
print(value) | |
case let (.None, .Some(error)): | |
print(error) | |
case let (.Some(value), .None(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
func doSomething(object: AnyObject) { | |
guard let object = object as? String where object.hasPrefix("hel") else { | |
return | |
} | |
print(object.uppercaseString) | |
} | |
doSomething("hello") |
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 catchAll(name: String?) { | |
do { | |
try throwSomething(name) | |
} catch { | |
print("An error occured") | |
} | |
} | |
func catchAllWithReference(name: String?) { | |
do { |
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
let names = ["karl", "marc", "john"] | |
struct SomeStruct { | |
static func uppercase(name: String) -> String { | |
return name.uppercaseString | |
} | |
func uppercase(name: String) -> String { | |
return name.uppercaseString | |
} |
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
CGContextSetFillColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update. |
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
Tribe$ cat Cartfile | |
github "realm/realm-cocoa" == 0.92.3 | |
github "SwiftyJSON/SwiftyJSON" >= 2.1.2 | |
github "Alamofire/Alamofire" >= 1.2 | |
github "onevcat/Kingfisher" >= 1.1.1 | |
github "ankurp/Dollar.swift" >= 3.0.0 | |
github "SnapKit/SnapKit" >= 0.11.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
import UIKit | |
class AdTableViewCell: UITableViewCell { | |
// MARK: Subviews | |
// Add subviews and constraints... | |
} |
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
import Foundation | |
enum Provider: String { | |
case Vimeo = "Vimeo" | |
case SoundCloud = "SoundCloud" | |
} | |
class Item { | |
let title: String | |
let provider: Provider |
NewerOlder