Use protocols {get} Can be used for let
{get set} Can be used for var On Thu, Dec 15, 2016 at 1:16 AM Benjamin Spratling via swift-evolution < swift-evolution@swift.org> wrote: > Howdy, > Thanks, I’ll consider this as an alternative. > I don’t see that this solves the issues of whether a property on a > class is let, however. > -Ben > > > On Dec 14, 2016, at 11:41 PM, Derrick Ho <wh1pch...@gmail.com> wrote: > > > > You might be able to ensure access modifiers by using protocols. > > > > If you want to ensure that a class has a property called foo that is > private you can make a private protocol that specifies a private property > called foo. > > > > This isn't a XCTest but it is a compile time check. If a programmer > tries to change a private property to public then the the compiler will > complain. > > > > The same can be done with final. Make a protocol with a static method. > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution >
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution