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
Post a Comment