forXifLess / LinkNavigator

🌊 Easy & Powerful navigation library in SwiftUI
Other
397 stars 29 forks source link

Support preview #6

Closed toanbv-fabbi closed 1 year ago

toanbv-fabbi commented 1 year ago

In your example, I cannot find any preview of all screen please support

jaeho-flitto commented 1 year ago

@toanbv-fabbi Hi, sorry for the late reply. LinkNavigator is a library for navigating pages dynamically. It's not difficult to put a Preview on every page, but as you know, you can't test the navigation functions in the Preview, so we omitted previews intentionally. I'd recommend you test demo apps on a simulator. 😄

r0otx commented 1 month ago

How I can void mock arg navigation in preview?

interactord commented 1 month ago

I don't quite understand. If you don't mind, could you explain it a bit more clearly?

r0otx commented 1 month ago

I don't quite understand. If you don't mind, could you explain it a bit more clearly?

If I create a page, then I initiate a navigator in it:

let navigator: RootNavigatorType

and in Preview block I'm see error:

image

How I can set mock navigator variable, example

#Preview {
    OTPView(phoneNumber: "", navigator: .constant(nil))
}
interactord commented 1 month ago

That sounds like a great idea! If you create it and send a PR, we will actively review and distribute it.

Thank you!