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
#!/usr/bin/env python | |
import lldb | |
def process(debugger, command, result, internal_dict): | |
lldb.debugger.HandleCommand(""" | |
expr -l swift -- | |
func $process(URLRequest: NSURLRequest) { | |
func curl(URLRequest: NSURLRequest) -> String { | |
guard let URLString = URLRequest.URL?.absoluteString else { |
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
extension UIControl { | |
var rac_tap: SignalProducer<Void, NoError> { | |
return rac_signalForControlEvents(.TouchUpInside) | |
.toSignalProducer() | |
.map { _ in () } | |
.flatMapError { _ in SignalProducer.empty } | |
} | |
} |
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 RxTests | |
let scheduler = TestScheduler(initialClock: 0) | |
Observable<Int>.interval(10, scheduler: scheduler) | |
.subscribe { _ in print(scheduler.now) } | |
scheduler.advanceTo(60) |
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 Result | |
import ReactiveCocoa | |
let scheduler = TestScheduler(startDate: NSDate(timeIntervalSince1970: 0)) | |
timer(10, onScheduler: scheduler) | |
.start { _ in print(scheduler.currentDate) } | |
scheduler.advanceByInterval(60) |
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
let OK = { | |
"Test" | |
} | |
let NG = { | |
let s = "Test" | |
return s | |
} | |
// error: unable to infer closure return type in current context |
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 | |
enum 入力: Int { | |
case 左下 = 1, 下, 右下, 左, 右 = 6, 左上, 上, 右上 | |
case パンチ = 0x10 | |
} | |
let 入力川 = PublishSubject<入力>() | |
_ = 入力川 |
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 | |
import RxSwift | |
let now = NSDate() | |
let scheduler = HistoricalScheduler(initialClock: now) | |
_ = Observable<Int>.interval(0.5, scheduler: scheduler) | |
.subscribe { print($0) } | |
scheduler.advanceTo(now.dateByAddingTimeInterval(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
extension ObservableType { | |
public func merge<O: ObservableConvertibleType where O.E == E>(second: O) -> Observable<E> { | |
return [asObservable(), second.asObservable()].merge() | |
} | |
} | |
extension SequenceType where Generator.Element : ObservableType { | |
public func merge() -> Observable<Generator.Element.E> { | |
return Merge(source: toObservable()) | |
} |
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 | |
import RxSwift | |
enum ズンドコ: UInt32 { | |
case ズン | |
case ドコ | |
} | |
let ズンドコ川 = Observable<Int>.interval(0.5, scheduler: MainScheduler.instance) | |
.map { _ in ズンドコ(rawValue: arc4random_uniform(2))! } |
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 | |
import RxSwift | |
enum ズンドコ: UInt32 { | |
case ズン | |
case ドコ | |
} | |
let ズンドコ川 = Observable<Int>.interval(0.5, scheduler: MainScheduler.instance) | |
.map { _ in ズンドコ(rawValue: arc4random_uniform(2))! } |