Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
Swift and Objective-C
Although you will write your classes in Swift, the classes in the Cocoa frameworks are written in Objective-C. Swift was designed to work seamlessly with Objective-C classes. While you can write Cocoa apps in pure Swift, without a line of Objective-C, it is important to have a basic understanding of how Objective-C works.
Objective-C methods (which are only available on classes, not structures) are not called like functions or like Swift methods. Instead of calling a method on an object, Objective-C sends the object a message.
A message consists of a receiver, selector, and any parameters. The selector is the name of the method you want executed. The receiver is the object that you want to execute that ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access