Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ReactiveCocoa 5.0

Sho Ikeda
August 20, 2016

ReactiveCocoa 5.0

iOSDC Japan 2016での発表資料です #iosdc https://iosdc.jp/2016/c/node/189

Sho Ikeda

August 20, 2016
Tweet

More Decks by Sho Ikeda

Other Decks in Programming

Transcript

  1. RAC 5.0 • Repository Split • API Design • Signal

    • SignalProducer • Properties • Atomic • Others
  2. Repository Split • ReactiveCocoa: ReactiveSwift + UI layers • ReactiveSwift:

    The core, platform-independent Swift APIs • ReactiveObjC: Objective-C APIs (e.g. RACSignal) • ReactiveObjCBridge: Swift <-> ObjC bridging layer
  3. API Design • Swift 3 API Design Guidelines: • #3001

    [5.0] Swift 3.0 Groundwork • #3028 Isolate unavailable APIs in 5.0. • Easier transition by the use of "@available(*, unavailable, renamed:..."
  4. Signal • Lifetime Semantics: • #2959 [5.0] Changes to the

    lifetime semantic of Signal. • ϝϞϦʔorϦιʔεϦʔΫ͕ͪ͠ͳͷΛղফ
  5. SignalProducer • SignalProducer.buffer is removed: • #3028 Isolate unavailable APIs

    in 5.0. • Use Properties or SignalProducer.replayLazily instead • SignalProducer.on: • #3097 Pre- and post-start hooks in SignalProducer.on. • started -> starting, started ʹ෼ׂ
  6. Properties • #3023 Unifying read-only properties, and making PropertyProtocol class

    bound. • Renamed PropertyProtocol is now class bound • AnyProperty -> Property • ConstantProperty -> Property(value:) • #2922 Property composition operators. • Signal, SignalProducerͱಉ౳ͷΦϖϨʔλʔͷ௥Ճ
  7. Atomic • Optimizations: • #2984 Adopt inout parameter in Atomic.modify.

    • #3123 Alter Atomic.modify to return the result of the supplied action.
  8. Others • #3030 Add Lifetime to enable observation of object

    deallocation in Swift class MyController { private let token = Lifetime.Token() var lifetime: Lifetime { return Lifetime(token) } func viewDidLoad() { super.viewDidLoad() fooBarProducer() .take(until: lifetime.ended) // .take(until: rac_lifetime.ended) .startWithNext { ... } } }
  9. Others • #3133 Generic ScopedDisposable // Generic ScopedDisposable class ScopedDisposable<InnerDisposable:

    Disposable>: Disposable { ... } class MyController { private let disposable = ScopedDisposable(CompositeDisposable()) func viewDidLoad() { super.viewDidLoad() disposable += fooBarProducer().startWithNext { ... } // disposable.innerDisposable.add(fooBarProducer().startWithNext { ... }) } }