โš–๏ธwillSet/didSet vs. get/set

Swift โŸฉ type โŸฉ property โŸฉ willSet/didSet vs. get/set

โš–๏ธ willSet/didSet (property observer) vs. get/set (computed property)

  • ้œ€ไธปๅ‹•่ชฟๆ•ดๆˆ–้™ๅˆถๅฑฌๆ€งๅ€ผๆ™‚๏ผŒ็”จ get/setใ€‚

  • ๅช้œ€็›ฃๆŽงๅฑฌๆ€ง่ฎŠๅŒ–ๆˆ–ๅŸท่กŒๅ‰ฏไฝœ็”จ๏ผŒ็”จ willSet/didSetใ€‚

  • computed property ๆœฌ่ณชไธŠไธ็›ดๆŽฅๅ„ฒๅญ˜ๅ€ผ๏ผŒไธๆ”ฏๆด willSet/didSetใ€‚

  • willSet/didSet ๅช่ƒฝ็”จๆ–ผ stored propertyใ€‚

Last updated