You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having to declare an empty init() might lead to a crash as mentioned in the Readme. It might be clearer to move this requirement to a static variable or function, which clear statement that it should not be used and is only a protocol requirement.
Examples
publicprotocolBackedDecodable:Decodable{/// Requirement for the `BackedProtocol` when decoding. Should not be used//// to instantiate a new value.staticvar emptyBacked:Self// orstaticvar _emptyBacked:Self// orstaticfunc _emptyBacked()->Self}
It's clear in the examples that this would require to make BackedDecodable having an associated type, which has its complexity. Meanwhile, it does appear that it's not required in the library to use objects of types BackedDecodable so this might not be a problem.
The text was updated successfully, but these errors were encountered:
@ABridoux that's a good idea. I improved it a little bit by changing the required init() for a required init(_:DeferredDecoder) where DeferredDecoder can't be init out of BackedCodable module, guarantying this init can't be used by mistake.
Idea
Having to declare an empty
init()
might lead to a crash as mentioned in the Readme. It might be clearer to move this requirement to a static variable or function, which clear statement that it should not be used and is only a protocol requirement.Examples
So the example
User
in Readme could become:Miscellaneous
It's clear in the examples that this would require to make
BackedDecodable
having an associated type, which has its complexity. Meanwhile, it does appear that it's not required in the library to use objects of typesBackedDecodable
so this might not be a problem.The text was updated successfully, but these errors were encountered: