Post

Replies

Boosts

Views

Activity

Change Sign In With Apple button style based on current color scheme
I'm having some issues with SwiftUI's SignInWithAppleButton's signInWithAppleButtonStyle. I am trying to change the color of the button based on the user's current scheme or if it changes. This is iOS 14 and SwiftUI: @Environment(\.colorScheme) var currentScheme @State var appleButtonWhite = false VStack{ SignInWithAppleButton( 								.signUp, 								onRequest: { request in							 										request.requestedScopes = [.fullName, .email] 								}, 								onCompletion: { result in 										switch result { 										case .success (let authResults): 												print("Authorization successful.") 			 										case .failure (let error): 												print("Authorization failed: " + error.localizedDescription) 										} 								} 						) 						.frame(minWidth: 0, maxWidth: .infinity) 						.signInWithAppleButtonStyle(appleButtonWhite ? .white : .black) } .onChange(of: currentScheme, perform: { (scheme) in 				if scheme == .light 				{ 						appleButtonWhite = false 				} 				else 				{ 						appleButtonWhite = true 				} 		}) When appleButtonWhite changes values, it renders the view as it should since the state is changing. When I debug the button it has the correct appleButtonWhite value, but for some reason the style just never changes. I have no idea why. I have done many style changes in my code with regular buttons and it works correctly based on different states. Any ideas why Apple's doesn't change?
1
0
2k
Dec ’20
Popover in SwiftUI is showing a sheet. Anyone else?
Hi, I have been trying to use a popover in SwiftUI in Xcode 12 Beta 2&3 and popovers are showing up as sheets. Here is my code: 		@State private var showPopover: Bool = false 		var body: some View { 				VStack { 						Button("Show popover") { 								self.showPopover = true 						}.popover( 								isPresented: self.$showPopover, 								arrowEdge: .bottom 						) { Text("Popover") } 				} 		} } However, no popover is presented. Instead it's a sheet. I submitted feedback, but I don't see anyone else complaining about it. I want to confirm I'm not the only one.
9
2
12k
Jul ’20