Uploaded image for project: 'Swift'
  1. Swift
  2. SR-8065

Allow decoding from NSDictionarys/NSArrays with PropertyListDecoder

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Foundation
    • Labels:

      Description

      Currently, PropertyListDecoder can only decode from instances of Data.
      Internally, it calls PropertyListSerialization.propertyList(from: data, options: [], format: &format) on that data to get a top level object, then calls an internal function decode<T>(_ type: T.Type, fromTopLevel container: Any) to perform the actual decoding.

      I think it would make sense to make that function public, as sometimes you already have a property list object that you want to decode into the correct swift classes. The only way to do that right now is to wastefully re-serialize it to Data first.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jayrhynas Jayson Rhynas
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: