ios - seetter connot be specified for readonly property upgrade to swift2.0 -


meet warning when upgrade project code swift 2.0.

public class extension : nsobject {   private(set) public var name : string = "" } 

above code prompt warning:setter connot specified readonly property. currently, how update these code adapt swift2.0

"the swift programming language (swift 2.1): access control" writes:

you can make property getter public, , property setter private, combining public , private(set) access level modifiers:

therefore, it's legal:

public class extension : nsobject {     public private(set) var name : string = "" } 

ps: way, works swift 2.0 too.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -