在 iOS15.1 的真实设备上关闭“使用 Apple 登录”模态视图时,模态视图会跳转到屏幕中央,然后动画到底部并消失。但解雇动画在模拟器上是正确的。我用“用苹果登录”测试了其他应用程序,它们也有同样的问题。
如何修复动画?
import SwiftUI
import AuthenticationServices
struct ContentView: View {
var body: some View {
VStack {
SignInWithAppleButton(.signIn,
onRequest: signInWithAppleOnRequest,
onCompletion: signInWithAppleOnComplete
)
}
.ignoresSafeArea(.all)
}
// MARK: Sign in with Apple on request
func signInWithAppleOnRequest(request: ASAuthorizationAppleIDRequest) {
request.requestedScopes = [.fullName, .email]
}
// MARK: Sign in with Apple on complete
func signInWithAppleOnComplete(result: Result<ASAuthorization, Error>) {
}
}
Run Code Online (Sandbox Code Playgroud)