最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】swift 3出错:’var’ parameters are deprecated and will be removed in Swift 3

Swift crifan 1240浏览 0评论

从:

    func removeTeam(var toRemoveTeamItemList:[TeamItem]) {

根据提示:

变成:

    func removeTeam( toRemoveTeamItemList:[TeamItem]) {

结果又出错:

Cannot use mutating member on immutable value: ‘toRemoveTeamItemList’ is a ‘let’ constant

‘var’ parameters are deprecated and will be removed in Swift 3

xcode – ‘var’ parameters are deprecated and will be removed in Swift 3 – Stack Overflow

swift3 – ‘var’ parameters are deprecated and will be removed in Swift 3 UIimage Gif – Stack Overflow

swift-evolution/0003-remove-var-parameters.md at master · apple/swift-evolution

改为:

    func removeTeam(teamItemListToRemove:[TeamItem]) {
        var toRemoveTeamItemList = teamItemListToRemove
        if existedTeamItem(gCurUserItem.curTeamId, teamItemList: toRemoveTeamItemList) {
            //TODO: need notify user, then begin to switch to remaining some team if available
//            SingletonRootNC().showViewController(alertCtrl, sender: self)
            switchToFirstAvailableTeam()

            for (curIdx, eachTeamItem) in toRemoveTeamItemList.enumerate(){
                if gCurUserItem.curTeamId == eachTeamItem.id {
                    toRemoveTeamItemList.removeAtIndex(curIdx)
                }
            }

        }

即可。

转载请注明:在路上 » 【已解决】swift 3出错:’var’ parameters are deprecated and will be removed in Swift 3

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
91 queries in 0.134 seconds, using 20.58MB memory