Recently I’ve been seeing the word “context” used in method names in Cocoa, but I don’t understand the meaning. I’ve seen it in places like Core Data (NSManagedObjectContext) and in Core Graphics (CGBitmapContextCreate) but it seems to be used all over (NSSet, NSArray, NSObject). I’m assuming that it comes from the c world.
What is this context they’re talking about?
It’s just terminology, the contexts you mention are unrelated. The word context is usually used to describe a particular “working space”.
For example, a
CGContextReforNSGraphicsContextstores a graphics space that you can perform drawing operations in.NSManagedObjectContextstores a “working set” ofNSManagedObjectsfor a particular persistent store.The documentation for each API describes in detail what each of these contexts are.