为什么我不能改变一个隐式解包的可选变量?
以下是重现问题的简短示例:
var list: [Int]! = [1]
list.append(10) // Error here
Run Code Online (Sandbox Code Playgroud)
Immutable value of type '[Int]' only has mutating members named 'append'
var number: Int! = 1
number = 2
number = 2 + number
number += 2 // Error here
Run Code Online (Sandbox Code Playgroud)
Could not find an overload for '+=' that accepts the supplied arguments
swift ×1