Swift: public readonly properties that are privately writable
| Originator: | apontious | ||
| Number: | rdar://17166691 | Date Originated: | 6/4/2014 |
| Status: | Closed | Resolved: | Duplicate/15747445 |
| Product: | Developer Tools | Product Version: | |
| Classification: | Reproducible: |
Summary: rdar://17136480 and probably other bugs are already about adding access control to Swift, so that entire properties can be public, or private, or module-only; this bug is about allowing mixed publicly constant/privately writable properties. Currently, in Obj-C, you can make the public interface of a class's property read-only, so other code can get at it but not change it (at least not without some fiddling), *AND* the private interface writable, so the class can continue to modify the value itself. I use this all the time to preserve encapsulation. Since Swift does not have this yet, I cannot write Swift code with the level of encapsulation I would like.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!