Join Todd Perkins for an in-depth discussion in this video Using key-value coding, part of Cocoa with Swift Essential Training.
- View Offline
- Exercise Files
…KeyValue coding in Cocoa enables you to…access an object's properties as you would a dictionary key value pair.…This concept also enables us to discuss bindings later on,…which is a powerful concept in Cocoa.…So in my window here I have a button that says List Books.…If you look in the connections inspector,…you can see that List Books is connected to the List Books method in App Delegate.…We'll go over to App Delegate in just a minute and…look at that method, but first I want to go to Book.swift.…
Here I am importing Cocoa.…I'm creating a subclass of NSObject called Book.…It has three properties.…Author and title are strings, and pageCount is an NSNumber.…An NSNumber is simply an object wrapper for a numeric value.…Now the reason I'm using NSNumber instead of an integer is because it's required to…use an object for KeyValue coding.…Here i'm overwriting init and then i'm giving default values for the properties.…
Let's go to AppDelegate.swift.…In here I created an array of books called allBooks.…And I initialized it on line 14.…
- Creating your first Cocoa app
- Understanding the relationship between Cocoa and Swift
- Creating a playground
- Working with variables, functions, arrays, and loops
- Creating basic interactions and quick connections
- Building custom controller classes
- Using delegates
- Creating and arranging interface elements
- Using data controls
- Debugging and troubleshooting
- Distributing a Cocoa application
Skill Level Beginner
1. Getting Started
Installing the tools1m 14s
2. Introduction to Swift
3. Core Cocoa Skills
5. Creating User Interfaces
6. Arranging User Interfaces
7. Using Data Controls
8. Debugging and Troubleshooting
9. Distributing an Application
10. Finishing Touches
Creating full-screen apps4m 56s
Next steps1m 36s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.