Can you have public(get) private(set) ? -not internal(get)

I use
private(set) var foo:String
in lots of my code. It's great.

However using in a module, foo is internal - and therefore inaccessible from outside the module

is there a way to achieve ?

public(get) private(set) var foo:String

to be doubly explicit. The goal is that foo should have a getter which is accessible from outside the module, but a private setter. Using only private(set) means that the getter is internal - so not accessible outside the module

public private(set)

2 Likes

I thought I'd tried that - but evidently not properly!

thank you.

Terms of Service

Privacy Policy

Cookie Policy