Nested NSArray in plist

Discussion in 'iOS Programming' started by tiltem, Jan 3, 2011.

  1. tiltem macrumors newbie

    Joined:
    Oct 18, 2010
    #1
    I am not clear on how to make a nested array, or dictionary, mutable from a plist. My plist structure is:
    Code:
    dictionary
       -dictionary
           -array
           - array
       -dictionary
           -array
           - array
    I need the arrays to be mutable, but have not been able to figure out how. I have read this can be done with mutableCopy, but am unclear as to how this is done.

    Thanks!
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    You need the arrays to be mutable but not the dictionaries containing them? If so, that's not really possible. Because by changing the value of the array, you'd also need the dictionary to be updated (since one of its subvalues has changed).

    P.S. To create a mutable copy of a non-mutable object is as simple as, in the case of an NSArray:
    Code:
    NSMutableArray *mutableArray = [nonmutableArray mutableCopy];
     

Share This Page