Create a Setter Only in Swift
Well if I really have to, I would use this. Swift compiler supports some attributes on getters, so you can use @available(*, unavailable): public subscript(index: Int) -> T { @available(*, unavailable) get { fatalError(“You cannot read from this object.”) } set(v) { } } This will clearly deliver your intention to the code users.