ObservableUserDefault icon indicating copy to clipboard operation
ObservableUserDefault copied to clipboard

Support for optional parameters?

Open 27shutterclicks opened this issue 6 months ago • 2 comments

Thanks for this macro. I love the idea of it, which aims to prevent code bloat and typing the same variable name multiple times.

However, it looks like in order to set a default value, you MUST provide all the parameters (key, defaultValue and store). Since the key is the same as the var name and I have no need to provide a custom store, I wish I could simply provide the defaultValue in the init, as follows:

import ObservableUserDefault

@Observable
final class StorageModel {
    @ObservableUserDefault(.init(defaultValue: false))
    @ObservationIgnored
    var showName: Bool
}

Can we hope to have optional parameters support?

Thanks.

27shutterclicks avatar Jul 31 '24 17:07 27shutterclicks