jeudi 20 août 2020

My If let statement is failing and I'm not sure why

Here is my code:

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    
    // Make sure we are acting on the correct segue
    if segue.identifier == "CreateJumpSpot", let jumpSpotCreatorControllerVC = segue.destination as? JumpSpotCreatorController {
        // Set the delegate in the JumpSpotCreatorController we're navigating to
        jumpSpotCreatorControllerVC.delegate = self
        
    } else if segue.identifier == "JumpSpotInfo", let jumpSpotInfoVC = segue.destination as? JumpSpotInfoController {
        print("eriubvwribvuorlaeD")
        if let senderAnnotationView = sender as? JumpSpotAnnotationView {
            let senderAnnotation = senderAnnotationView.annotation as? JumpSpotAnnotation
            jumpSpotInfoVC.titleLabel.text = senderAnnotation?.title
            jumpSpotInfoVC.imageView.image = senderAnnotation?.image
            jumpSpotInfoVC.descriptionLabel.text = senderAnnotation?.description
            jumpSpotInfoVC.heightLabel.text = senderAnnotation?.estimatedHeight
            jumpSpotInfoVC.warningsLabel.text = senderAnnotation?.warnings
            print("YOYOYOYO")
        }
    }
}

For the second segue, with identifier "JumpSpotInfo", I know the code is getting up to the if let statement because the print("eriubvwribvuorlaeD") shows up in the debugger, but I have no idea why the code inside the if let won't execute. Any ideas?

Aucun commentaire:

Enregistrer un commentaire