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
Arkadii Ivanov
06/27/2022, 10:39 PM
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
Adam Brown
06/27/2022, 10:40 PM
oh the SwiftUI previews is a great use case
Adam Brown
06/27/2022, 10:40 PM
that has been really annoying so far
l
Landry Norris
06/28/2022, 2:12 AM
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
Landry Norris
06/28/2022, 2:13 AM
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.