In the sample project, Mark DiFranco begins building a class responsible for managing the app's location permissions. He applies the concepts of single responsibility and dependency inversion to keep the class small, and independent of other classes.
- [Instructor] Let's start by implementing…the authorization class.…In the location group that we've created, earlier…let's add a new file called SPDLocationAuthorization…and hit the create button in the bottom right…to create the file.…This class will act as the spd location manager…authorization delegate and offer up a nice interface…for our UI to use.…Let's start by defining a protocol for this class.…
We'll call the protocol SPDLocationAuthorization.…Inside the protocol, let's add a single function…called checkAuthorization.…Below the protocol we can create the class.…This class will be called SPDDefaultLocationAuthorization…this will be the concrete implementation of our protocol.…
We'll use this naming scheme to keep things organized.…Below this class, we can create an extension…to have it conform to our protocol.…This is another organizational tactic,…we can keep just the properties and the initializer…in the class definition.…So, let's implement checkAuthorization method.…In order to implement this, we're going to need an instance…
- Why write unit tests?
- What is dependency injection?
- Using protocols to help with tests
- Handling external dependencies
- Anatomy of a test case
- Writing tests
- Analyzing code coverage
- Visualizing test results
- Writing and extending UI tests
Skill Level Intermediate
1. Dependency Injection
2. Using Protocols
3. Writing Tests
4. UI Tests
- 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.