vmanot / reactor Goto Github PK
View Code? Open in Web Editor NEWThe most advanced state management framework for SwiftUI.
The most advanced state management framework for SwiftUI.
Getting compiler error on the following file: ReactorActionTask.swift
Error: Call to main actor-isolated instance method 'trigger' in a synchronous nonisolated context
public final class ReactorActionTask<R: Reactor>: PassthroughTask<Void, Error>, ExpressibleByNilLiteral {
var reactor: R?
var action: R.Action?
public required convenience init(nilLiteral: ()) {
self.init(action: { })
}
}
extension ReactorActionTask {
public class func failure(_ error: Error) -> Self {
.init { attemptToFulfill in
attemptToFulfill(.failure(error))
}
}
public class func error(description: String) -> Self {
.init { attemptToFulfill in
attemptToFulfill(.failure(CustomStringError(description: description)))
}
}
public static func trigger<Coordinator: ViewCoordinator>(
_ route: Coordinator.Route,
in router: Coordinator
) -> Self {
.action {
router.trigger(route) // Here <----
}
}
}
status(of: Action) is returning active when the action fails instead of error. mapError is being called as well.
Getting the following error: Type of expression is ambiguous without more context
Is it happening due to 3 definitions for eraseToActionTask?
func task(for action: Action) -> ActionTask {
switch action {
case .startPocketMoneyFlow:
return repository
.getPocketMoneySub()
.receiveOnMainQueue()
.map { $0.results?.first }
.publish(to: \.pocketMoneySub, on: authenticatedContext)
.then {
self.isPocket = false
}
.mapError{ (error) -> Error in
return error
}
.eraseToActionTask() // <- Here
In @ReactorRepository() repository :
public func getPocketMoneySub() -> AnyPublisher<PaginatedL<User.PocketSubscription>, Error> {
serverSession
.task(with: .getPocketSub)
.successPublisher
.tryMap({ try $0.unwrap(ServerResponse.getPocketSub) })
.eraseToAnyPublisher()
}
Crashing on presentOnTop
ViewReactor+DynamicViewPresenter.swift
public func present(_ item: AnyModalPresentation, completion: @escaping () -> Void) {
guard let presenter = environment.environment.presenter else {
return assertionFailure() _// crashes here_
}
var item = item
item.content.mergeEnvironmentBuilderInPlace(coordinator.environmentBuilder)
presenter.present(item, completion: completion)
}
Logs
Reactor/ViewReactor+DynamicViewPresenter.swift:33: Fatal error
Reactor/ViewReactor+DynamicViewPresenter.swift:33: Fatal error
I like the library you created, like SwiftUIX Merge.
If it is a library similar to RxSwift's ReactorKit, I would like to make good use of this library, and I would like to have a document for that.
And I tried implementing it with the code in the readme of the current master branch, but it doesn't seem to work.
Thanks for always providing a good library! ๐ฅ
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.