Join David Okun for an in-depth discussion in this video Refactoring your camera, part of Swift: Writing Reusable Frameworks.
- [Instructor] Now that we've cleaned up…our view controller,…let's create our camera object so that we can…add all of our AV foundation code in the right place.…Click on File, New, and add a new file…in the same project file as your camera framework.…We're going to add a new Cocoa Touch Class,…and we're going to name it Camera.…It should be a sub-class of NSObject.…Click Next, make sure that you're in the right folder,…and create it.…It should show up right underneath…your camera view controller.…Underneath UIKit, you're going to also want to import…AVFoundation, then go inside of your Camera class.…
First let's add our constructor.…If you type required, it will give you the ability…to autocomplete your required constructor.…The only parameter we'll put here is with controller…equals CameraViewController.…And you want to put self.controller…equals controller.…After that you want to add a stored property…right above that that says var controller…equals CameraViewController,…and it should be optional.…Now we're going to add the stored properties…
Along 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
- Creating a framework delegate
- Adding media
- Capturing images
- Correcting orientation
- Versioning and tagging releases in Git
Skill Level Intermediate
Learning Server-Side Swift with Vaporwith Ron Buencamino1h 30m Intermediate
Learning Swift Playgrounds Application Developmentwith Steven Lipton2h 58m Intermediate
Swift: Delegations and Data Sourceswith Steven Lipton31m 49s Beginner
1. Let's Make It Work
2. Let's Keep It Clean
3. Putting It All Together
4. Track It
Tagging releases in Git2m 36s
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?
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.