Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binder Architecture with Apple's Combine Framework ? #10

Open
npvisual opened this issue Mar 26, 2020 · 1 comment
Open

Binder Architecture with Apple's Combine Framework ? #10

npvisual opened this issue Mar 26, 2020 · 1 comment

Comments

@npvisual
Copy link

Since ReactiveKit is in the process of API alignment with Apple's Combine framework, and more and more people are using SwiftUI, would it make sense to revisit the Binder Architecture and update it to reflect the use of both frameworks (Combine + SwiftUI)?

I'd find it particularly interesting to understand the impact on existing code as I am slowly learning/moving to Combine and SwiftUI (the latter somewhat forcing the former into light).

The AbsurdGitter sample would be a nice side-by-side comparison, especially if it showed how SwiftUI somewhat aligns with the concepts introduced by LayoutLess in this example.

Thanks!

@npvisual
Copy link
Author

Maybe we can start a discussion on this 😁 to kick things a little bit further down the road...

So from what I can tell (just getting acquainted with SwiftUI and Combine), it appears that SwiftUI forces the Binding layer into the View declarations with @EnvironmentObject and @ObservedObject. Effectively making the Binding layer sort of obsolete in that context.

I.e. any sort of binding between information provided by a service and a view, in the Binder Architecture, is pushed inside the View's struct declaration in most of the SwiftUI samples I have seen. That couples the model and the view definition very tightly and doesn't give much space to create the view / binding / service separation.

Using an intermediary object that relies on very simple types (String, Int, Bool, etc.) to be included in the View definition and then using that object in the Binding to bridge between the service data and the view data is one way to close the gap between SwiftUI and the Binder Architecture to leave as much of the Service logic hidden from the View.

However this only works well for changes in the "state" model. Actions on the other hand seem to be more difficult to abstract away from the View's struct definition (button clicks that drive an action, for example).

Would love to hear suggestions on how to make this "integration" possible...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant