Unable to refer to local function error in Xcode 6 beta 6

I just updated Xbox 6 beta 6 from beta 4 and I get an error message that I don't understand.

I get the error "Cannot reference a local function from another local function."

        var alert = UIAlertController(title: "Start Over", message: "Are you sure you want to start over? This will erase your budget and all transactions.", preferredStyle: UIAlertControllerStyle.Alert)
    alert.addAction(UIAlertAction(title: "I'm sure!", style: UIAlertActionStyle.Default, handler:{ (ACTION :UIAlertAction!)in
        resetView()
        }))
    alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil))

    self.presentViewController(alert, animated: true, completion: nil)

Error in resetView () line of code.

0
source share
2 answers

The error message is very explainable.

resetView is a local function, and you cannot reference it from another local function.

To resolve the problem, move resetViewoutside the local area.

-1
source

resetView . , , .

+2

All Articles