Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelesantos authored Mar 19, 2024
1 parent bc96b7b commit 8bb7fd6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,23 @@ let package = Package(
]
)
```

## Usage

```swift
import RefdsInjection

protocol MockViewModelProtocol {
var id: UUID { get }
}

class MockViewModel: MockViewModelProtocol {
var id: UUID
init(id: UUID) { self.id = id }
}

let expectedID = UUID()
RefdsContainer.register(type: MockViewModelProtocol.self) { MockViewModel(id: expectedID) }
let viewModel = RefdsContainer.resolve(type: MockViewModelProtocol.self)
let receivedID = viewModel.id
```

0 comments on commit 8bb7fd6

Please sign in to comment.