write&read Swift Dictionary to Documents

Discussion in 'iOS Programming' started by Zelda, Nov 29, 2016.

  1. Zelda macrumors member

    Joined:
    Aug 10, 2014
    #1
    I am looking for information to write and read a Swift Dictionary to the Documents directory of iOS.
    Can this be done?
    Any pointers?
    Thanks
     
  2. Dookieman macrumors 6502

    Joined:
    Oct 12, 2009
    #2
    You can't simply "save" a dictionary directly to a file, it's just a data structure. You need to create a file where the dictionary data can be held within a container and saved such as a plist. A plist is a simple file format that mimics a dictionary structure with a type "key:value" container. iOS has native support for this so Google around and look for "save dictionary to plist".
     
  3. Zelda thread starter macrumors member

    Joined:
    Aug 10, 2014
    #3
    Ah, ok I did notice quite a few search results about plist and Swift dictionary's.
    Thank you, I appreciate your answer.
     

Share This Page