Mark DiFranco begins using assemblies with the classes in the sample project. An Assembly is created for each class, at the bottom of the class' file. Each assembly registers the class with its container.
- [Instructor] Now that we've created each of our classes,…let's use Swinject to register all of them in a container.…We'll head over to the SPDLocationManager class.…At the top of the file, we'll import the Swinject framework.…We can then scroll to the bottom of the class…and we'll create a new assembly class.…For our naming convention, we'll take the name of the file,…SPDLocationManager, and append Assembly on the end.…
We'll update it to conform to the Assembly protocol.…As we covered earlier, the Assembly protocol…requires a single method, assemble.…We can use the passed in container to register our class.…We'll call the register method,…and for the Service.Type,…we'll specify our SPDLocationManager.…To access the type, we'll use .self.…
We'll then implement the factory block.…The only (mumbles) passed into the block is the Resolver.…We use r to denote the Resolver.…We can remove most of this boilerplate code…around the block.…Inside the block,…we just need to return the SPDLocationManagerProxy.…If you remember from earlier,…
- 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?
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.