rundfunk47 / stinsen

Coordinators in SwiftUI. Simple, powerful and elegant.
MIT License
822 stars 87 forks source link

Can't I use onDismiss in route method? #108

Closed redok016 closed 1 year ago

redok016 commented 1 year ago

I have a question. I define route in my coordinator class like below.

...
@Route(.modal) var createTodo   = makeCreateTodo
...
@ViewBuilder func makeCreateTodo() -> some View {
    CreateTodoView(todoList: todoList)
}
...

And when I call this route at outside. I would like to call route method just like this.

router.route(\.createTodo, onDismiss:{
})

Is there any way receive onDismiss callback on calling route method?

redok016 commented 1 year ago

Ok I found the way. When I access coordinator of router, there is a method route(:onDismiss).