Follow

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!

gist.github.com/phillipcaudell

@phill this immediately reminded me of this package, which I have used with great success in the past:

github.com/Flight-School/AnyCo

@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.

Sign in to participate in the conversation
The Not So Big Company

The home of The Not So Big Company on Mastodon.