Skip to content

Commit

Permalink
Add a note about the UIApp
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Jun 1, 2016
1 parent 6e5d85b commit 16297fe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -14,6 +14,8 @@ Currently, the library provides testing replacements for:
- [NSUserDefaults](#user-defaults)
- [NSFileManager](#file-manager)
- [View trait collections](#trait-collections)
- [UIApplication](#uiapplication)


These can be used with [Dependency Injection](#dependency-injection), or by using OCMock to replace global singletons.

Expand Down Expand Up @@ -76,6 +78,10 @@ You can stub the trait collections for `UIView` and `UIViewController`, the two
[subject stubHorizontalSizeClass:UIUserInterfaceSizeClassRegular];
```
### UIApplication
Nothing to out of the normal here, you can create a `ForgeriesApplication` which is a UIApplication subclass for DI-ing a test.
### Dependency Injection
The trick is to use Forgeries in _testing only_. A great way to do this is via _Dependency Injection_. This means injecting a dependency into an instance, instead of having that instance create the dependency itself, or access shared state. Let's take a look at an example.
Expand Down

0 comments on commit 16297fe

Please sign in to comment.