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
func f(_ arg: inout String) { | |
arg = "🐥" | |
arg = "🐓" | |
} | |
var egg: String = "🥚" { | |
didSet { print(oldValue) } | |
} | |
f(&egg) |
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
lelt _: (Int) -> Int = { $0 + 1 } |
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
class SomeClass { | |
var v: Int! | |
} |
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 RxSwift | |
import RxCocoa | |
extension Reactive where Base: UITextField { | |
var nonOptionalText: Observable<String> { | |
return base.rx.text.asObservable().map { text -> String in | |
if let _ = text { | |
return text! | |
} | |
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
'use strict' | |
const sleep = someFunction => { | |
return new Promise(resolve => { | |
setTimeout(() => { | |
resolve(someFunction()) | |
}, 5000) | |
}) | |
} |
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
'use strict' | |
const sleep = someFunction => { | |
return new Promise(resolve => { | |
setTimeout(() => { | |
resolve(someFunction()) | |
}, 5000) | |
}) | |
} |
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 | |
public struct Maker<Product> { | |
let product: Product | |
} | |
extension Maker where Product: UILabel { | |
public func set(textColor color: UIColor) -> Maker { | |
self.product.textColor = color | |
return self |
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 | |
public struct UILabelMaker { | |
let label: UILabel | |
} | |
extension UILabelMaker { | |
public func set(textColor color: UIColor) -> UILabelMaker { | |
self.label.textColor = color | |
return self |
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
'use strict' | |
const sleep = (someFunction) => { | |
setTimeout(someFunction, 5000) | |
} | |
// Promise | |
const promiseFunction = (() => { | |
return new Promise((resolve, reject) => { | |
sleep(() => { |