[swift-evolution] [Proposal] Protected Access Level
Pyry Jahkola
pyry.jahkola at iki.fi
Mon May 30 01:09:21 CDT 2016
That's a cool hack! For a lighter way to distinguish overridable methods that one shouldn't ordinarily call, did anyone consider approximating "protected" (or as called in Objective-C speak, "private extension") methods with public class methods?
public class UIView {
public class func _layoutSubviews(_ view: UIView)
}
This way, they become overridable, won't show up in the editor auto completion list for a given instance, and can be called… but definitely make you think twice before you do!
— Pyry
> Callionica (Swift) via swift-evolution <swift-evolution at swift.org> kirjoitti 30.5.2016 kello 7.49:
>
> I've written up how to provide protected access control for Swift code today here:
>
> http://www.callionica.com/developer/#swift-protected
>
> No compiler changes necessary for this technique and it distinguishes between methods that can only be overridden and methods that can be both called and overridden.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160530/e2e86e03/attachment.html>
More information about the swift-evolution
mailing list