前提・実現したいこと
LocalAuthentication
を用いて、FaceID
とTouchID
の認証機能を実装中です。
認証機能自体は実装できましたが、少し気になる点があります。
システムアプリや、大手のアプリで認証を行う際、
生体認証(特にFaceID
)の際にアニメーションが終わってから、画面遷移などの処理が行われています。
今回Googleでの検索結果などを元に実装を行ったところ、
認証直後、アニメーション途中にもかかわらず、裏で画面の遷移が行われてしまいます。
こちらをアニメーション完了後に画面遷移(その他処理)を行いたいのですが、そのような手段はありますでしょうか?
該当のソースコード
swift
1var error: NSError? 2let context = LAContext() 3if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) && UserDefaults.standard.bool(forKey: "Biometrics") { 4 context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: "サンプル確認のための認証チェック", reply: { success, error in 5 if success { 6 print("認証成功") 7 DispatchQueue.main.async { 8 let viewController = self.storyboard?.instantiateViewController(withIdentifier: "ViewController2") 9 self.navigationController?.pushViewController(viewController!, animated: true) 10 } 11 } else { 12 print("認証失敗:" + (error?.localizedDescription)!) 13 } 14 }) 15} else { 16 print("touchID非対応") 17}
あなたの回答
tips
プレビュー