launchdarkly / ios-client-sdk

LaunchDarkly Client-side SDK for iOS (Swift and Obj-C)
https://docs.launchdarkly.com/sdk/client-side/ios
Other
68 stars 82 forks source link

feat: Introduce variation method with generic return types #342

Closed keelerm84 closed 4 months ago

keelerm84 commented 4 months ago

Customers using a JSON flag often prefer the evaluation result return a custom object instead of an LDValue. This commit supports that by introducing a new LDValueDecoder (copied and lightly modified from the Swift Core Libs JSONDecoder implementation).

This decoder allows decoding into arbitrary types directly from an LDValue, without paying the penalty for an intermediate JSON encoding step (i.e. LDValue -> JSON str -> Custom Type).

shortcut-integration[bot] commented 4 months ago

This pull request has been linked to Shortcut Story #160632: iOS SDK investigates a method to turn JSON LDValue into a dictionary or raw string for easy consumption..