- Introduction to Functional Programming Johannes Weiß - http://kcy.me/1ngiv
- ReactiveCocoa at MobiDevDay Andrew Sardone - http://kcy.me/1nhl3
- The Future Of ReactiveCocoa Justin Spahr-Summers - http://kcy.me/1nhs7
- Enemy of the State Justin Spahr-Summers - http://kcy.me/1njzs
- WWDC 2014 Session 229 - Advanced iOS Application Architecture and Patterns Andy Matuschak - http://kcy.me/1pyva
- Functioning as a Functionalist Andy Matuschak - http://kcy.me/22o45
- Controlling Complexity in Swift Andy Matuschak - http://kcy.me/23sc9
- Functional and reactive programming with Swift Ash Furrow -
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 ReactiveShortViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let pan = UIPanGestureRecognizer() | |
pan.delegate = self | |
let rotate = UIRotationGestureRecognizer() | |
rotate.delegate = self | |
view.gestureRecognizers = [pan, rotate] |
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 ImperativeShortViewController: UIViewController { | |
private var timerCreator: TimerCreator | |
private var panPresent = false | |
private var rotatePresent = false | |
private var gestureTimer: TimerType? | |
private var secondsLeft = 3 | |
private var tickCount = 0 | |
init(timerCreator: TimerCreator) { |
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
// Fire API request | |
searchBar | |
.rx_text | |
.throttle(0.5, scheduler: MainScheduler.instance) | |
.distinctUntilChanged() | |
.filter { $0.characters.count > 0 } | |
.flatMapLatest { findRepository($0).retry(3) } | |
.flatMapLatest { repository -> [Issue] in | |
return findIssues(repository) | |
} |
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
// Fire API request then bindTo Tableview | |
searchBar | |
.rx_text | |
.throttle(0.5, scheduler: MainScheduler.instance) | |
.distinctUntilChanged() | |
.filter { $0.characters.count > 0 } | |
.flatMapLatest { findRepository($0) } | |
.flatMapLatest { repository -> [Issue] in | |
return findIssues(repository) | |
} |
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
private var lastScheduledWord: dispatch_cancelable_block_t? | |
private var lastRequest: NSURLSessionTask? | |
func searchRepository(keyword: String) { | |
cancel_block(lastScheduledWord) | |
lastRequest?.cancel() | |
lastRequest = nil | |
lastScheduledWord = dispatch_after_delay(0.5) { |
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
private var lastScheduledWord: dispatch_cancelable_block_t? | |
private var lastRequest: NSURLSessionTask? | |
var numberOfRetries = 3 | |
let NUMBER_OF_RETRIES = 3 | |
func searchRepository(keyword: String) { | |
cancel_block(lastScheduledWord) | |
lastRequest?.cancel() | |
lastRequest = 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
@jamiepinkham | |
public extension ObservableType { | |
func then(closure: () -> Observable<E>?) -> Observable<E> { | |
return then(closure() ?? .empty()) | |
} | |
func then(@autoclosure(escaping) closure: () -> Observable<E>) -> Observable<E> { | |
let next = Observable.deferred { |
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
extension RowOf: ReactiveCompatible {} | |
extension Reactive where Base: RowType, Base: BaseRow { | |
var value: ControlProperty<Base.Cell.Value?> { | |
let source = Observable<Base.Cell.Value?>.create { observer in | |
self.base.onChange { row in | |
observer.onNext(row.value) | |
} | |
return Disposables.create() |
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
// ObservableBuffer.swift | |
// | |
// Created by Daniel Tartaglia | |
// Copyright © 2017 Daniel Tartaglia. MIT License. | |
extension Observable { | |
/// collects elements from the source sequence until the boundary sequence fires. Then it emits the elements as an array and begins collecting again. | |
func buffer<U>(_ boundary: Observable<U>) -> Observable<[E]> { | |
return Observable<[E]>.create { observer in |
OlderNewer