I'm currently trying to write a little iOS application in swift, where I have these Classes:
masterTableViewController
addViewController
and deleteViewController
, each of them is connected to a, like the name already tells, viewController. The masterTableViewController should sent some data using the predefined function:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if(segue.identifier == "showDetails") {
var selectedIndexPath:NSIndexPath = self.tableView.indexPathForSelectedRow()!
var deleteViewController:deleteViewController = segue!.destinationViewController as deleteViewController
deleteViewController.todoData = todoItems.objectAtIndex(selectedIndexPath.row) as NSDictionary
}
I want to send the data of the current row to the next, by segue referenced controller.
This is where I get an error message stating that deleteViewController is not a type that can be assigned to a variable.
But I don't really understand what the problem s right now. Basically this should work because I just want to create a new object of the type my class is of and pass this one to my view controller.
In the reference I got this code from everything worked just fine.
You are mixing class names and instance variable names. Class names should be upper case: MasterTableViewController, AddViewController, DeleteViewController
At first, try to distinguish between the class name and the instance variable name by choosing a different name, i.e.:
var dvc:deleteViewController = segue!.destinationViewController as deleteViewController
dvc.todoData = ...
And see if it works
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With