Skip to content

Dependency usage during initialization #157

Answered by jshier
chrsmys asked this question in Q&A
Discussion options

You must be logged in to vote

You can access the dependency right in the initializer:

init(dependencies: Dependencies = .init) {
  @Dependency(\.uuid) var uuid
  sessionID = uuid()
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@chrsmys
Comment options

@gsabran
Comment options

Answer selected by chrsmys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants