Marshal
Marshal copied to clipboard
making contextType optional in UnmarshalingWithContext and UnmarshalUpdatingWithContext protocols
For some databases like Realm managed Object are not systematically persisted and doesn't need a context to be initialised: a Realm object in this case. Having to create a Realm (or other type of coordinator) each time we want to generate those type of object even if we don't need it can lead to real performance issues.
That why I propose in my pull request to make the context an optional in both UnmarshalingWithContext and UnmarshalUpdatingWithContext protocols.
That is a good point, this is a breaking API change though so we'll have to give it some thought.
Do we change this API? Provide new API? Not sure.
Is any change really required? It's an associated type, so optional context is just another type. I just tried it out in my app and it appears to be fine.