Join David Okun for an in-depth discussion in this video Using the exercise files, part of Swift: Writing Reusable Frameworks.
- [Instructor] Throughout this course, you will have Exercise Files available to you. You can download them and put them on your desktop, so that you can jump in at any point throughout this course. Let's take a look at what that folder looks like. You'll see that there are different sets of chapters along with a Resources folder at the root level of this folder. If we jumped into Chapter 02, you would see folders that indicate where we are at each particular portion of this course. Jumping in at any point will show you the files that you need in order to work with that particular section of the course. It's important to point out that this course is continuous, and each particular section will build on the previous section.
If you start from the beginning of this course and follow it all the way through, you'll have everything up and running. At the beginning of the course, we'll explain how to set up your development environment. However, if you're jumping in at a later part of the course, it's important to know exactly how to set up your development environment so that you can get a certain section working. I'm going to show you what you need to do to jump in at any particular part of this course. Open up the CameraWorkspace file. You'll notice that you have two Xcode projects included in your Xcode Workspace, the CameraFramework and the SampleApplication.
The development environment involves building a framework and deploying it into a sample application to test on an iOS device. In order to configure this to work with any particular project, first, make sure that the device you select is the iOS device that you have plugged into your machine. Make sure you select the CameraFramework scheme at first. Hit Command + B on your keyboard to build the framework. On the left hand side, you'll notice that the framework is built inside of the Products folder. If you see a CameraFramework highlighted in red in your SampleApplication, click on it and hit Delete on your keyboard.
Then, right-click on the framework that you just built and click Show In Finder. You'll want to take that framework file that you just built and drag it underneath the Frameworks folder in your SampleApplication. Don't check anything additional on this particular dialog, and click Finish. Lastly, you'll need to go to the Xcode project for your SampleApplication. Scroll down to the bottom, and make sure that you hit the plus button underneath Embedded Binaries. Select the framework that's inside of your SampleApplication Xcode project, and click Add.
Lastly, go up to the Scheme selector and select your SampleApplication. Try to build the SampleApplication onto your iOS device. If it says Build Succeeded, you're now ready to pick up where this chapter begins in the course. One last thing to bring up, though we are going to complete a camera framework by the end of this course, it's important to point out that this is based on an open source library that I have available on GitHub right now. The library is called Lumina, and you can find it on GitHub at the following URL. It's a more fleshed out camera framework than what we'll be making in this course, but the framework that we're making is based on this library.
I encourage you to go check this library out online if you're interested in learning more after the completion of this course.
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