Top "Cocoa" questions

Cocoa is Apple's application-development framework for macOS, consisting of Foundation, Application Kit, and Core Data.

What does the NS prefix mean?

Many classes in Cocoa/Cocoa Touch have the NS prefix. What does it mean?

ios objective-c cocoa cocoa-touch
Best way to remove from NSMutableArray while iterating?

In Cocoa, if I want to loop through an NSMutableArray and remove multiple objects that fit a certain criteria, what's …

objective-c cocoa
How do I declare class-level properties in Objective-C?

Maybe this is obvious, but I don't know how to declare class properties in Objective-C. I need to cache per-class …

objective-c cocoa oop
How to print out the method name and line number and conditionally disable NSLog?

I'm doing a presentation on debugging in Xcode and would like to get more information on using NSLog efficiently. In …

objective-c cocoa cocoa-touch xcode nslog
How to get pixel data from a UIImage (Cocoa Touch) or CGImage (Core Graphics)?

I have a UIImage (Cocoa Touch). From that, I'm happy to get a CGImage or anything else you'd like that's …

cocoa cocoa-touch core-graphics
How to initialise a string from NSData in Swift

I have been trying to initialise a string from NSData in Swift. In the NSString Cocoa Documentation Apple is saying …

string swift cocoa nsdata
How to use performSelector:withObject:afterDelay: with primitive types in Cocoa?

The NSObject method performSelector:withObject:afterDelay: allows me to invoke a method on the object with an object argument after …

objective-c cocoa
How to update a single pod without touching other dependencies

I understand that the following command will update a single pod: pod update <podname>. However this also updates …

cocoa cocoapods
NSString property: copy or retain?

Let's say I have a class called SomeClass with a string property name: @interface SomeClass : NSObject { NSString* name; } @property (nonatomic, …

objective-c cocoa cocoa-touch
throwing an exception in objective-c/cocoa

What's the best way to throw an exception in objective-c/cocoa?

objective-c cocoa exception-handling