hGen hGen - 5 months ago 14
Swift Question

Swift 'use of undeclared type'

i am currently trying to write a little iOS applicationin swift, where I have these Classes:

, 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.

and this is where I get the message that an error occurred that deleteViewController is not a Type to assign to a variable.

But I dont 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