Codable support
Is your feature request related to a problem?
You don't support Codable when using capture for events.
Describe the solution you'd like
Getting error: key does not conform to NSCoding and cannot be serialized for delivery.
Describe alternatives you've considered
Allow Codable
Additional context
Thanks! Looking forward to reply.
Thank you for your feature request – we love each and every one!
@JoeFerrucci do you mean https://developer.apple.com/documentation/swift/codable ?
Yes, that is the one. When I try to pass a dictionary into capture(event:properties:) it fails with that error.
Here is a trivial example to help highlight it
struct MyType: Codable {}
posthog?.capture("My Event", properties: ["somekey": MyType()])
This yields the error. Technically PostHog SDK only needs to support Encodable; it doesn't need to be Decodable
Note: the error appears at runtime when you try to send the data over the wire; it's not a compile time error.
We're currently rewriting the iOS SDK and we'll consider this use case, thanks for the context. Edit: Consider using the customstringconvertible as well.