Avatar
swiftbot BOT 6/4/2018 2:13 AM
Author icon
koher
struct Stone { var name: String = "" { didSet { let newValue = name if recCount == 5 { return } recCount += 1 print("name.didSet begin: \(oldValue) -> \(newValue)") name.append("x") print("name.didSet end: \(oldValue) -> \(newValue)") } } var recCount = 0 } var b = Stone() b.name = "taro"
Version:
swift-4.1.1-RELEASE
Output:
name.didSet begin: -> taro name.didSet end: -> taro
Error: