Search code examples
cocoafoundationnsset

Why doesn't NSSet have a writeToFile method?


I know that I can store NSSet's in an NSArray, but why isn't a dedicated writeToFile method provided? It must be a very common use case.

I just want to learn.


Solution

  • The writeToFile method of NSArray and NSDictionary writes the contents as property list.

    The reason NSSet lacks the method is that NSSet is not property list compliant.

    But since NSSet can be initialized with an array and has an allObjects property to get an array the loss is not that bad.