How can I implement polymorphic decoding of JSON data in Swift 4?
问题 I am attempting to render a view from data returned from an API endpoint. My JSON looks (roughly) like this: { "sections": [ { "title": "Featured", "section_layout_type": "featured_panels", "section_items": [ { "item_type": "foo", "id": 3, "title": "Bisbee1", "audio_url": "http://example.com/foo1.mp3", "feature_image_url" : "http://example.com/feature1.jpg" }, { "item_type": "bar", "id": 4, "title": "Mortar8", "video_url": "http://example.com/video.mp4", "director" : "John Smith", "feature