0

I am trying to get a secondViewController to appear after I (1) click a button and (2) verify a condition.

In my if statement that verifies the condition I use a performSegue to pull up the secondViewController ("dispenseScreen"). However, when I do this it pulls up a window that just sits on top of the home screen but is not replacing it.

Does anyone know what I need to do to completely replace the home screen?

This is my code:

@IBAction func touchID(_ sender: Any)
   {

       let context:LAContext = LAContext()

       //Removes Enter Password during failed TouchID
       context.localizedFallbackTitle = ""

       if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil)
       {
           context.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, localizedReason: "We require your TouchID", reply: {(wasCorrect, error) in DispatchQueue.main.async {
               self.isBiometryReady()
                   if wasCorrect   {

                       self.performSegue(withIdentifier: "dispenseScreen", sender: self)
                       print("Correct")
                   }
                   else {
                       print("Incorrect")
                   }
               }
           })
       } else {
           //Enter phone password if too many login attempts
           //Add message alerting user that TouchID is not enabled
       }

   } 
palacetrading
  • 71
  • 1
  • 11
  • Try to change the kind of the segue (with "dispenseScreen" identifier) on your storyboard as "Show (e.g. Push)". – Luke Apr 11 '20 at 01:30
  • @Teo hey teo, so that pretty much worked. I changed it to push and at first it threw an error but then I added a navigation controller and than made it work. The second screen is now a standalone view and not a window on top. However, the issue I have now is that the second screen has a back button which I do not want. Do you know how to remove that? – palacetrading Apr 11 '20 at 01:41
  • I think you should not add a navigation controller if you don't want a back button. It might be a better idea to try to fix that new error in another way. – Luke Apr 11 '20 at 01:47

0 Answers0