In Xcode 7.3, if you click tableview without using the storyboard, you will be writing the source for the screen transition to DetailViewController.swift.
I would like to substitute the value of self.List [indexPath.row] for CustomViewController.entry, but I got an error saying cannot assign value of type self.List [indexPath.row] and I cannot substitute it.
The self.List [indexPath.row] contains the URL.
How do I pass the URL to the CustomViewController without using sugue?
override functableView(tableView:UITableView, didSelectRowAtIndexPath:NSIndexPath){
letCustomViewController=DetailViewController()
CustomViewController.entry=self.List [indexPath.row]
parent!.navigationController!.pushViewController(detailViewController, animated:true)
}
I would like to substitute the value of self.List [indexPath.row] for CustomViewController.entry, but I got an error saying cannot assign value of type self.List [indexPath.row] and I cannot substitute it.
The error indicates a type mismatch: CustomViewController.entry
and self.List [indexPath.row]
do not match and cannot be substituted.
Swift is a type-sensitive language, for example, you cannot even substitute a value of type Float
for a variable of type Double
.You can only substitute variables of type Any
for variables of type parent class with child class instances, between upcast and typealias, and between the same entity.
The self.List [indexPath.row] contains the URL.
If you only write the URL, but you don't know if it's a string type or an instance of NSURL
, you can't move on.And the problem is not directly related to "how to pass a URL without using suuge." (suuge
→seuge
)
© 2024 OneMinuteCode. All rights reserved.