-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MBL-1014: Replace ReactiveSwift in ReportProjectFormViewModel with Co…
…mbine (#1873) * [msadoon] Add Combine support to Apollo client * Add createFlaggingInputCombine to Service * Add fetchGraphUserEmailCombine to Service * MBL-1014: Replace ReactiveSwift in ReportProjectFormViewModel with Combine * Use @StateObject for ReportProjectFormViewModel * Add //TODOs with ticket numbers for leftover tasks
- Loading branch information
1 parent
b74f1cb
commit 36ea6fe
Showing
13 changed files
with
346 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Combine | ||
import Foundation | ||
|
||
public final class CombineTestObserver<Value, Error: Swift.Error> { | ||
public private(set) var events: [Value] = [] | ||
private var subscriptions = Set<AnyCancellable>() | ||
|
||
public func observe(_ publisher: any Publisher<Value, Error>) { | ||
publisher.sink { _ in | ||
// TODO(MBL-1017) implement this as part of writing a new test observer for Combine | ||
fatalError("Errors haven't been handled here yet.") | ||
} receiveValue: { [weak self] value in | ||
self?.events.append(value) | ||
} | ||
.store(in: &self.subscriptions) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Combine | ||
import Foundation | ||
import ReactiveSwift | ||
|
||
extension Signal where Error == Never { | ||
var combinePublisher: AnyPublisher<Value, Never> { | ||
let subject = PassthroughSubject<Value, Never>() | ||
self.observeValues { value in | ||
subject.send(value) | ||
} | ||
|
||
return subject.eraseToAnyPublisher() | ||
} | ||
|
||
public func assign(toCombine published: inout Published<Value>.Publisher) { | ||
self.combinePublisher.assign(to: &published) | ||
} | ||
} |
Oops, something went wrong.