Naming convention for Private Properties
问题 I've seen underscore used as a prefix for private properties private var _aPrivateVar: String = "I am private" I've seen them not used private var aPrivateVar: String = "I am private" Syntactically, it makes no difference and my preference is to not use them. However, what's the accepted convention in Swift so that I pick the right habit up? 回答1: In this Swift Guide style, you can find a similar reference: private var centerString: String { return "(\(x),\(y))" } In The swift Programming