'var' parameters are deprecated and will be removed in Swift 3 'var' parameters are deprecated and will be removed in Swift 3 xcode xcode

'var' parameters are deprecated and will be removed in Swift 3


The discussion of the removal of Var from a function parameter is fully documented within this submission on GitHub: Remove Var Parameters

In that document you will find that people often confuse var parameters with inout parameters. A var parameter simply means that the parameter is mutable within the context of the function, while with an inout parameter the value of the parameter at the point of return will be copied out of the function and into the caller's context.

The correct way to solve this problem is to remove var from the parameter and introduce a local var variable. At the top of the routine copy the parameter's value into that variable.


Have you tried to assign to a new var

public func getQuestionList(language: String) -> NSArray {    var lang = language    if self.data.count > 0 {        if (lang.isEmpty) {            lang = "NL"        }        return self.data.objectForKey("questionList" + lang) as! NSArray    }    return NSArray()}


Just add this one line at the beginning of the function:

var language = language

and the rest of your code can stay unchanged, like this:

public func getQuestionList(language: String) -> NSArray {    var language = language    if self.data.count > 0 {        if (language.isEmpty) {            language = "NL"        }        return self.data.objectForKey("questionList" + language) as! NSArray    }    return NSArray()}