Join David Okun for an in-depth discussion in this video Make the camera work: Part 2, part of Swift: Writing Reusable Frameworks.
- [Instructor] Let's go ahead and finish off…making our camera work for our reusable framework.…We need to add two more functions to our view controller…in our framework before we can actually test it out…in our sample application.…The first one will be a very, very quick function.…Scroll down to line 34,…and underneath didReceiveMemoryWarning,…write a function called createUI.…Here we're going to type…self.view.layer.addSublayer(getPreviewLayer(self.session)).…All we're going here is using the function…we made to get our preview layer…and adding it to our hierarchy of view layers…in a UI view controller.…
Underneath createUI, you're going to make another function…called commitConfiguration.…This will take no parameters as well; open it up.…Now here we're going to write a do-catch block in Swift.…So we write do and open it up.…For the sake of convenience,…write you catch right after that,…and for this, we're only going to be hailing one type of error,…so type print("Error linking device to AVInput!!").…This will make sense as soon as we finish typing out…
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 4: Protocol-Oriented Programmingwith Károly Nyisztor1h 44m Intermediate
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?
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.