State / e.g. struct AppState: ReSwift.StateType { var timelineState = TimelineState() var userProfileState = UserProfileState() } struct TimelineState: ReSwift.StateType { var tweets: [Tweet] var response: [Tweet] }
Store open class Store: ReSwift.StoreType { var state: State! { get } private var reducer: Reducer open func dispatch(_ action: Action) { ... } open func subscribe(_ subscriber: S) { ... } open func unsubscribe(_ subscriber: AnyStoreSubscriber) { ... } ... }
rxThunkMiddleware struct SingleAction: ReSwift.Action { public let single: Single public let disposeBag: DisposeBag } let rxThunkMiddleware: ReSwift.Middleware = { dispatch, getState in return { next in return { action in if let action = action as? SingleAction { action.single .observeOn(MainScheduler.instance) .subscribe(onSuccess: { next($0) }) .disposed(by: action.disposeBag) } else { return next(action) } } } }
RxDatasource — https://github.com/RxSwiftCommunity/RxDataSources — O(N) algorithm for calculating differences — the algorithm has the assumption that all sections and items are unique so there is no ambiguity — in case there is ambiguity, fallbacks automagically on non animated refresh