简体   繁体   中英

Prepare for Segue with iOs 10.0

Adding the code

@available(iOS 10.0, *)

has resulted in the error: overriding 'prepare' must be as available as declaration it overrides when trying to implement:

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

Is this easily fixable?

Thanks.

Just implement following code..

   if #available(iOS 10.0, *) {

          override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

               // if(segue.identifier == "segue"){

               //     let temp : UINavigationController =  segue.destination as! UINavigationController
               //     let second : ViewController =  temp.viewControllers.first as! ViewController       

               // }

         } else {
                        // Fallback on earlier versions
         }
   }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM