There was an old open discussion about having pure setters for properties, e.g. - properties that cannot be read, but only written to. It was rejected at the time, but I've actually faced a different common need that I can't express in Swift, and wonder if it's reasonable to want it to be in Swift :)
It's inline with the previous suggestion, but not really the same. Instead of having "set only" properties, it would be highly useful to have more granular ACL for the read property.
For example, a public-read, private-write property is expressed by:
public private(set) var item: SomeType
But there is no way, currently, to provide the opposite, e.g.
public private(**get**) var item: SomeType
This is really helpful for push-style input-only interfaces such as RxSwift's Relay/Subject, but it really is useful for any situation where you want to provide an input-style interface, in general.
As of today, if you want to provide a "input" for some object, such as "Let object X know that some value has changed", there is no way to prevent the writer to also read the value back.
In my experience it is a relatively common use case, but I'm really interested to hear other people's opinions on this.
Do you imagine this being useful to you, or part of Swift?
Thanks for reading !