Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #24 from hainayanda/improvement/callbackcallmove
Browse files Browse the repository at this point in the history
Call callback now run first
  • Loading branch information
hainayanda authored Jun 6, 2022
2 parents a089b34 + c9d3c99 commit 91731f5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions Pharos/Classes/Observable/Subject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ public final class Subject<Wrapped>: BindableObservable<Wrapped> {
_wrappedValue
}
set {
let oldValue = _wrappedValue
_wrappedValue = newValue
relay(
changes: Changes(old: oldValue, new: newValue, source: self),
changes: Changes(old: _wrappedValue, new: newValue, source: self),
context: PharosContext()
)
}
Expand Down
2 changes: 1 addition & 1 deletion Pharos/Classes/Relay/BindableKVOObservable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ final class BindableKVOObservable<Object: NSObject, Observed>: BindableObservabl
super.superRelay(changes, context)
self.recentSource = .none
case .external:
super.superRelay(changes, context)
super.callCallback(changes)
super.superRelay(changes, context)
case .none:
return
}
Expand Down
2 changes: 1 addition & 1 deletion Pharos/Classes/Relay/BindableObservable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ open class BindableObservable<State>: RootObservable<State> {
}

override func relay(changes: Changes<State>, context: PharosContext) {
superRelay(changes, context)
callCallback(changes)
superRelay(changes, context)
}

public override func relayChanges(to relay: BindableObservable<State>) -> Observed<State> {
Expand Down

0 comments on commit 91731f5

Please sign in to comment.