In macOS development, you can create custom delegate classes. Meaning you can define your own delegation, or protocol methods and send the messages to an object's delegate. See how it works in this video.
- [Instructor] So let's look at writing a custom delegation…protocol and implementing it in a custom object.…So here in my app I just have a button…and it's connected to this method clickedButton…in my AppDelegate class.…So the first step is to define the delegate protocol.…And I'm going to do that in AppDelegate.swift.…And I'm going to do it right underneath my import statement.…So I'll use the protocol keyword…and then when swift protocol is highlighted…I'll press return on my keyboard.…
And then I need to give it a name.…I'm going to call this CustomDelegate.…And for requirements, I'm just going to…declare a customDelegateExample.…And that's it.…So now we've declared our protocol.…Now what we're going to do is create a custom class.…So I'll press Command N, and then under macOS…I'll choose Cocoa Class.…Hit next.…We'll call this OtherObject.…
And it can be a Subclass of NSObject, Language Swift.…And hit Next.…Hit Create to create it in the default location.…So we have AppDelegate.swift which defines…the CustomDelegate protocol, and OtherObject.…
- Installing your development tools
- Working with Xcode and the MVC pattern
- Creating basic interactions
- Creating delegate classes
- Building a user interface
- Laying out the UI
- Working with data and table views
- Binding data objects to the UI
- Debugging your app
- Distributing the app
Skill Level Beginner
1. Get Started
2. Core Cocoa Skills
4. Create User Interfaces
5. Arrange User Interfaces
6. Use Data Controls
7. Debug and Troubleshoot
8. Distribute an Application
9. Finishing Touches
Create full screen apps1m 51s
Next steps1m 21s
- 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.