-
Notifications
You must be signed in to change notification settings - Fork 485
example of ViewBuilder issue #1250
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
example of ViewBuilder issue #1250
Conversation
public var googleButton: some View { | ||
if googleProvider != nil { | ||
// For purpose of demonstration | ||
// This produces "Type 'any View' cannot conform to 'View'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterfriese - the problem is when we try to render from core package, Xcode produces this compiler error. I don't know how to get around it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you take a look at https://gist.github.com/peterfriese/d9745f366fb4f857daf077e93b1eb01f and see if this approach helps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterfriese - here is the commit attempting to follow your example: 8c38462
(#1250)
@@ -28,7 +28,8 @@ extension AuthPickerView: View { | |||
Text(authService.authenticationFlow == .login ? "Login" : "Sign up") | |||
VStack { Divider() } | |||
EmailAuthView() | |||
|
|||
// Xcode compiler exception: Type 'any ExternalAuthProvider' cannot conform to 'ExternalAuthProvider' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterfriese - Following your gist example, we get this Xcode compiler error now.
I tried to remove any ExternalAuthProvider
from the types in auth service for each provider but it isn't allowed because ExternalAuthProvider uses an associated type (ButtonType), Swift requires you to explicitly acknowledge it as an existential by using any ExternalAuthProvider
.
Hacked together for purpose of demonstration only.