Not that it's a bad thing anyway, but is there a s...
# decompose
a
Not that it's a bad thing anyway, but is there a specific reason to define the Components as an interface first? There is only every one implementation as far as I can figure, nothing platform specific ever, so the interface will always map to the implementation one to one
a
Good question! There is no specific reason, you can avoid interfaces if you don't need them. But there are at least two use cases for component interfaces: 1. Test/fake implementations in integration tests 2. Fake implementations for Compose/SwiftUi previews
3
a
oh the SwiftUI previews is a great use case
that has been really annoying so far
l
I find it's good to provide default definitions for the interface methods because of previews. That way you just need to pass in object: MyLogic and you only need to override the state.
👍 1
When testing, if I need to make sure a method gets called, I can pass in an object that overrides that method and sets a boolean or counter.
1