Skip to content
Discussion options

You must be logged in to vote

Hi @Namedix, good to hear, and we also discuss that gotcha in the docs.

Although I would like to know when we should initialize values and when not, is there any rule we should follow?

Both styles are fine to use and are legitimate. But sometimes only the computed static property style is possible because you need to capture some state on the inside, like in the SpeechClient. But if you don't need to capture that state, then a static let is just fine. Or if you prefer to coalesce on a single style for consistency, then feel free to use static var all the time.

Replies: 1 comment 2 replies

Comment options

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

@mbrandonw
Comment options

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