struct Stack<Element> {
var items = [Element]()
func push(_ item:Element){
self.items.append(item)
}
mutating func pop() -> Element{
return self.items.removeLast()
}
}
Cannot use mutating member on immutable value: 'self' is immutable
Mark method 'mutating' to make 'self' mutable
protocol Response {
var _metrics: AnyObject? { get set }
func add(_ metrics: AnyObject?)
}
extension Response {
func add(_ metrics: AnyObject?) {
_metrics = metrics
}
}
Cannot assign to property: 'self' is immutable
Mark method 'mutating' to make 'self' mutable