rundfunk47 / stinsen

Coordinators in SwiftUI. Simple, powerful and elegant.
MIT License
926 stars 98 forks source link

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

Closed redok016 closed 2 years ago

redok016 commented 2 years 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 2 years ago

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