janeh
janeh

Reputation: 3804

Use NSDictionary or create a class with properties?

I am a beginner in cocoa programming. In my mac os app, I am saving .webarchive files, and I also need to save some app-only data - (like tags, etc) associated with that webarchive. Should I use NSDictionary for these properties or create a class with @properties? What are the advantages of saving attributes in NSDictionary?

Upvotes: 4

Views: 266

Answers (1)

Will Pragnell
Will Pragnell

Reputation: 3123

Typically, the reason for creating a class/object is when you expect it to have some sort of behaviour. So, if you're likely to repeatedly perform the same manipulations on the data you are saving, then it's probably worth defining a class. If you simply need to save the data and access it later, then an NSDictionary sounds like a more sensible choice.

Upvotes: 4

Related Questions