Skip to content

Commit

Permalink
Updated usage to reflect 1.0.1 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pedantix authored May 1, 2020
1 parent 1eef37b commit 8183fd9
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,31 @@ class MyInjectedObject {
@Inject var bar: Bar
@Inject var baz: Baz
@Inject var container: Container
}

func prototypeExample() {
foo // 0x001, a different object every call
foo // 0x002, a different object every call
}
func prototypeExample() {
let obj1 = MyInjectedObject()
let obj2 = MyInjectedObject()
obj1.foo // 0x001, a different object every injection
obj2.foo // 0x002, a different object every injection
}

func singletonExample() {
bar // instance 0x001.
bar // instance 0x001. the same instance until the app resets
}
func singletonExample() {
let obj1 = MyInjectedObject()
let obj2 = MyInjectedObject()
obj1.bar // instance 0x001.
ob2bar // instance 0x001. the same instance until the app resets
}

func singletonExample() {
baz // instance 0x001.
baz // instance 0x001. the same instance until the session is reset
container.resetSession()
baz // instance 0x002
}
func sessionExample() {
let obj1 = MyInjectedObject()
let obj2 = MyInjectedObject()
let obj3 = MyInjectedObject()

obj1.baz // instance 0x001.
obj2.baz // instance 0x001. the same instance until the session is reset
container.resetSession()
obj3.baz // instance 0x002
}
```

Expand Down

0 comments on commit 8183fd9

Please sign in to comment.