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
Core Data for iOS and macOS Enterprise Developerswith Jon Bott1h 46m Intermediate
Learning Server-Side Swift with Vaporwith Ron Buencamino1h 30m Intermediate
Swift 3 Essential Training: Beyond the Basicswith Scott Gardner2h 58m 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?
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.