ReactiveCocoa 5.0

7ddcca09c00a2744b983974225447d19?s=47 Sho Ikeda
August 20, 2016

ReactiveCocoa 5.0

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

7ddcca09c00a2744b983974225447d19?s=128

Sho Ikeda

August 20, 2016
Tweet

Transcript

  1. 3.
  2. 4.
  3. 5.
  4. 6.
  5. 7.

    RAC 5.0 • Repository Split • API Design • Signal

    • SignalProducer • Properties • Atomic • Others
  6. 8.

    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
  7. 9.

    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:..."
  8. 10.

    Signal • Lifetime Semantics: • #2959 [5.0] Changes to the

    lifetime semantic of Signal. • ϝϞϦʔorϦιʔεϦʔΫ͕ͪ͠ͳͷΛղফ
  9. 11.

    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 ʹ෼ׂ
  10. 12.

    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ͱಉ౳ͷΦϖϨʔλʔͷ௥Ճ
  11. 13.

    Atomic • Optimizations: • #2984 Adopt inout parameter in Atomic.modify.

    • #3123 Alter Atomic.modify to return the result of the supplied action.
  12. 14.

    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 { ... } } }
  13. 15.

    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 { ... }) } }