RxSwift to Combine (Park Bo-young)
summary
Shows how an iOS app using RxSwift (a Punk API beer list) is migrated to Combine and SwiftUI. Covers concrete code: networking with URLSession.DataTaskPublisher and JSONDecoder.decode, view bindings using @ObservedObject/@Published and a PassthroughSubject trigger, and subscription management with AnyCancellable instead of DisposeBag. Compares Combine’s type model (Publishers carry Output+Failure, use AnyPublisher), operator differences (tryMap, added/missing operators), subject types (PassthroughSubject, CurrentValueSubject), threading and combineLatest limits, and reports much smaller binary size and lower memory/CPU in benchmarks.
AI-written summary · about
chapters (26)
- 0:00Introduction
- 1:05Apple created Combine
- 3:13Combine vs RxSwift concepts
- 5:23Publishers and Subjects
- 8:22Operators differences
- 10:32Combining operators
- 11:34Subjects in Combine
- 12:40Memory management
- 13:47Thread handling
- 15:13Summary
- 15:42Code setup
- 16:46Network request comparison
- 19:00RxSwift architecture
- 21:57RxSwift ViewModel
- 23:45SwiftUI intro
- 24:28SwiftUI state
- 27:25SwiftUI example
- 28:10Combine ViewModel
- 31:48Final code comparison
- 32:48Code size reduction
- 33:54Performance comparison
- 35:22Combine benefits
- 36:06Compatibility limits
- 36:53Integration challenges
- 37:15Future outlook
- 37:56Closing
