小弟刚刚学swift些了一段代码但是运行时报错感觉很迷惑,希望有人可以解惑什么地方错了:
class Pushpop<T> {
var items = [T]()
func push(item:T) {
items.append(item)
}
func pop() {
items.removeLast()
}
}
var stack = Pushpop<String>()
stack.push("things")
stack.push("other")
stack.pop()
stack.push("ss")
for item in stack.items {
print(item)
}