最新消息:20190529 VPS服务器已从腾讯云香港换为Vultr新加坡,主题仍用朋友推荐的大前端D8

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

Swift crifan 557浏览 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,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
60 queries in 0.095 seconds, using 18.59MB memory