Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyapuchka committed May 11, 2016
1 parent f759665 commit e4faae6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ To injecte dependencies in this view controller when it is instantiated from sto

1. Register the dependencies in the `DependencyContainer`, as well as `MyViewController`:

```swift
```swift
import Dip

@UIApplicationMain
Expand All @@ -70,6 +70,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
container.presenter = try container.resolve() as MyViewControllerPresenter
container.service = try container.resolve() as MyViewControllerService
}

DependencyContainer.uiContainer = container
}
}
```
Expand All @@ -79,10 +81,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

3. Make your view controller class conform to `StoryboardInstantiatable` protocol:

```swift
```swift
extension MyViewController: StoryboardInstantiatable { }
```

> Tip: Do that in the Composition Root to avoid coupling your view controller's code with Dip.
4. In a storyboard (or in a nib file) set _Dip Tag_ attribute on your view controller. This value will be used to lookup definition for view controller, so it should be the same value that you used to register view controller in the container.

![img](adding-dip-tag-in-ib.png?raw=true)
Expand All @@ -109,4 +113,4 @@ Now when view controller will be loaded from a storyboard Dip-UI will intercept

## License

**Dip-UI** is available under the **MIT license**. See the `LICENSE` file for more info.
**Dip-UI** is available under the **MIT license**. See the `LICENSE` file for more info.

0 comments on commit e4faae6

Please sign in to comment.