I have a requirement similar to the one described in this question.
I want to dynamically generate getters and setters for a Swift class inheriting from NSObject at runtime (in a similar manner to what NSManagedObject does behind the scenes).
The answers for that question, mentions the usage of @dynamic, to supress Objective-C compiler warnings and then also perform swizzling of methods.
In addition when using CoreData in Swift we have the @NSManaged attribute which tells the Swift compiler that this properties storage is not usual storage but has some custom backing store provided by CoreData.
Is there a way to similarly tell the Swift compiler that my properties for a custom class have custom backing store and not use the usual Swift provided storage?
I am thinking of property wrappers to modify storage, but is it the right direction to go towards or is there some other way?
If we use property wrapper there is one particular feature that I would find unpleasant and want to avoid, when declaring a property using the custom Property wrapper:
@MyCustomPropWrapper(backingStore: someStore) var counter: Int