Are there any docs on SKIE <Flows in SwiftUI> feat...
# touchlab-tools
d
Are there any docs on SKIE Flows in SwiftUI feature that show what is the recommended way to trigger the equivalent of a Compose side effect?
For the example in the docs on the website:
Copy code
struct ExampleView: View {
    let viewModel = SharedViewModel()

    var body: some View {
        // Observing multiple flows with attached initial values, only requiring a single view closure for content.
        Observing(viewModel.counter.withInitialValue(0), viewModel.toggle) { counter, toggle in
            Text("Counter: \(counter), Toggle: \(toggle)")
        }
    }
}
What is the recommended way to trigger a function (i.e. navigation) when the counter reaches
100
for example ?
f
That looks more like a SwiftUI question. I think you could use the
.task(id) {}
modifier in SwiftUI which starts a task when the id changes. It's very similar to
LaunchedEffect
in Compose
d
Should we be using SwiftUI's onChange maybe ?
f
Yeah,
onChange
looks good as well
d
Thanks, just wanted to confirm that SwiftUI's built in tools will work correctly with SKIE's Flow transformation etc
f
I have never used it, to be honest, but it's just a normal SwiftUI, so I don't see a reason why it wouldn't work.
👍 1