Join David Okun for an in-depth discussion in this video Normalizing your image data, part of Swift: Writing Reusable Frameworks.
- [Instructor] We now have a way…to get image data out of your AVCapturePhotoDelegate.…However, now we need to normalize that image data…so that we can handle the orientation…of the device correctly.…Go underneath the extension for the camera you made…that handles AVCapturePhotoCaptureDelegate.…You'll add another extension,…this time on type AVCapturePhoto.…Open up the brackets and type a function signature…called normalizedImage.…The parameter you'll pass in will be called…forCameraPosition position: CameraPosition.…
For this, it'll return an optional UIImage.…Let's take a look at this…before we start typing the function.…We need to specify the position of the camera that we're in,…whether we're looking at the front or the back.…This will be apparent when we handle orientation…later in the course.…We're also making sure that we return an optional UIImage.…The representation of the data that we're working with…may be nil, and if that's the case,…we need to not send back an image…and we need to tell the camera to try again.…
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
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.