It's easy to check protocol conformance of a type at runtime:
guard type is Encodable.Type else { ... }
but this technique fails if type
is not a struct
or class
, but instead a protocol
that inherits from Encodable
. Is there a way to make a similar check for protocols?
Aucun commentaire:
Enregistrer un commentaire