[swift-evolution] [Proposal] Foundation Swift Archival & Serialization

Itai Ferber iferber at apple.com
Wed Mar 22 12:41:56 CDT 2017


Hi Ben,

What’s the use case that you were thinking of? `KeyPath`s could be 
useful in the case where you don’t need to customize your key names, 
but cannot represent a custom case like

```swift
public struct Post {
     var authorID: Int
     var bodyText: String

     private enum CodingKeys : String, CodingKey {
         case authorID = "author_id"
         case bodyText = "body_text"
     }
}
```

Or am I misunderstanding?

— Itai

On 22 Mar 2017, at 5:39, Ben Rimmington wrote:

>> On 15 Mar 2017, at 22:40, Itai Ferber wrote:
>>
>> The following introduces a new Swift-focused archival and 
>> serialization API as part of the Foundation framework. We’re 
>> interested in improving the experience and safety of performing 
>> archival and serialization, and are happy to receive community 
>> feedback on this work.
>
> Instead of a CodingKeys enum, could the KeyPath proposal 
> <https://github.com/apple/swift-evolution/pull/644> be utilized 
> somehow?
>
> -- Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170322/77d232f3/attachment.html>


More information about the swift-evolution mailing list