uitableview - what replaces indexPathForSelectedRow in Swift 3? -
in projects prior swift 3 - if looking segue indexpath tablecontroller, i'd have line of code
let indexpath = self.tableview.indexpathforselectedrow!
however, in swift 3, unable write this. can't seem find documentation on apple's site or other questions find workable piece of code.
in response frankie's comment, went code (here of current segue swift 3 code) , have tried copy , paste above code snippet... no avail. xcode not auto complete if enter "self.tableview". not recognize indexpathforselectedrow! either. i'm missing something.
override func prepare(for segue: uistoryboardsegue, sender: any?) { if segue.identifier == "dinesegue" { if let destinationviewcontroller = segue.destination as? restaurantcontroller { let indexpath = dinecontroller.indexpathforselectedrow! destinationviewcontroller.restaurantindex = index } } }
i googled 'indexpathforselectedrow apple documentation` , able find property reference conveniently first result.
https://developer.apple.com/reference/uikit/uitableview/1615000-indexpathforselectedrow
that being said, it's posted in swift 3.
self.tableview.indexpathforselectedrow
Comments
Post a Comment