I need an ”AnyCodable" type for serialising some generic stuff.
Is something like this the best approach now that we have existentials on protocols?
AnyThoughts appreciated!
https://gist.github.com/phillipcaudell/99d1fe52873d0c5115bc281272003784
@phill this immediately reminded me of this package, which I have used with great success in the past:
https://github.com/Flight-School/AnyCodable
@mattiem thanks for sharing! I did stumble across this, but wondered if Swift 5.7 could make all the casting/switching redundant.
@phill it may be able to! In my specific case, it mostly did. But the code I had to write was much simpler because I knew I was dealing with only JSON-compatible data types.
The home of The Not So Big Company on Mastodon.
@phill it may be able to! In my specific case, it mostly did. But the code I had to write was much simpler because I knew I was dealing with only JSON-compatible data types.