-
Notifications
You must be signed in to change notification settings - Fork 15
Xcode preview support for custom views #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @merbula, thank you for raising this issue. Our team will discuss and evaluate whether this should be considered an expected functionality or if it requires implementation as a new feature. |
Using Xcode previews with custom views is currently not supported, as the states are not meant to be initialized outside the component. In the meantime, you can workaround this restriction for custom Sign In, Sign Up and Reset Password views by using the #Preview {
Authenticator(
initialStep: .signIn,
signInContent: { state in
MyCustomLoginView(state: state)
}
) { state in
Text("Test")
}
} |
This has been addressed in version 1.1.2 with the introduction of a For example: import Authenticator
struct CustomSignInView: View {
@ObservedObject var state: SignInState
var body: some View { /*...*/ }
}
#Preview {
CustomSignInView(
state: PreviewFactory.States.signIn()
)
} |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Uh oh!
There was an error while loading. Please reload this page.
Is there a way to get Xcode preview working when using custom views? For example custom login preview gives error: "'SignInState' initializer is inaccessible due to 'internal' protection level"
struct MyCustomLoginView: View {
@StateObject var state: SignInState
}
#Preview {
let state = SignInState(...)
return MyCustomLoginView(state: state)
}
The text was updated successfully, but these errors were encountered: