fluent-kit
fluent-kit copied to clipboard
Separate Field property wrappers into separate package
I have a model In my project that is simply serialised and sent to a Swift server to process.
My client-side build needs a whole bunch of nio dependancies simply to accommodate some properties decorated with a @Field annotation.
Is it possible to separate this so I can use @Field, @ID etc without needing swift-nio?
@lmcd No I don't think it is. The property wrappers require the enclosing type to be a Model to make all the syntactic sugar work and there's not really a way around that.
For sharing models across server and clients, we strongly recommend sharing only DTOs which doesn't have this issue
There's no way to solve this with protocols? Seems a bit over the top that just defining a model needs to import a massive event loop library and all of its dependancies, and there's no possible way to disentangle the two.
You can't require property wrappers on properties in a protocol so there's no way for us to achieve this unfortunately
Will close this out, feel free to reopen if you have any other suggestions