Any application that uses a framework is going to need to be notified when things happen. As you make your camera framework, you need to set up a delegate so that the application can be aware of events that the camera performs. The best part of this is that you likely already know how to do it.
- [Narrator] Now let's talk about how to handle…events that occur inside of your framework.…If you've worked with IOS Development to this point,…it's very likely that you've encountered…the use of a delegate,…which gives you the functionality…to call back to one object from another.…We're going to follow the same kind of logic here…by implementing a delegate that's inside…of your camera controller to call back…to the application using your framework.…Go to the line that says import AV Foundation.…Hit return, and underneath it type public protocol,…camera, controller, delegate.…
You'll notice that we specified it to be public…so that the application that uses this framework…has access to this protocol.…We're going to type one function…called func, cancel, button, tapped,…and the parameter will pass in is the controller…on which the cancel button was tapped.…Think about the use case here.…When we're dealing with a cancel button being tapped,…you need to make sure that that's a button occurs on the UI,…and you want to have custom logic…
Author
Released
11/21/2017Along the way, he explains the differences and nuances between writing code for an application and for a reusable framework, as well as some of the fundamentals of AVFoundation, one of the core camera frameworks in iOS. David also shows how to refactor your code, understand Swift access control, develop an interface, and handle memory leaks, so your framework is ready to share with other developers.
- Creating your first build
- Making the camera work
- Refactoring
- Creating a framework delegate
- Adding media
- Capturing images
- Correcting orientation
- Versioning and tagging releases in Git
Skill Level Intermediate
Duration
Views
Related Courses
-
Learning Server-Side Swift with Vapor
with Ron Buencamino1h 30m Intermediate -
Swift: Writing Testable Code
with Mark DiFranco3h 11m Intermediate -
Swift 4: Protocol-Oriented Programming
with Károly Nyisztor1h 44m Intermediate
-
Introduction
-
Welcome44s
-
What you should know1m 59s
-
Using the exercise files2m 52s
-
-
1. Let's Make It Work
-
Setting your goal2m 11s
-
Create your first build3m 32s
-
Make the camera work: Part 15m 21s
-
Make the camera work: Part 24m 11s
-
-
2. Let's Keep It Clean
-
Refactoring your camera8m 7s
-
Handling rotation4m 45s
-
3. Putting It All Together
-
Capturing a still image6m 57s
-
Normalizing your image data2m 47s
-
Checking for leaks4m 37s
-
4. Track It
-
Tagging releases in Git2m 36s
-
Conclusion
-
Next steps1m 47s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Creating a framework delegate