Skip to content

Understanding the ApiClient & Session structure #159

Answered by stephencelis
oliverfoggin asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @oliverfoggin!

As it's a static function this could be called multiple times in the project and each time it would give you a new ApiClient. (I know this isn't the case in this project but it's possible). Is this something that has been considered and is just not done due to using the Environment in TCA? Or is there something protecting against that being done?

The app entry point is what provides an environment to this store, and this environment value does not change over time. We even have a helper static let in the file responsible for creating the store here:

isowords/App/iOS/App.swift

Lines 118 to 122 in 699db8a

extension ApiClient {
static let live = Self.live(

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@oliverfoggin
Comment options

Answer selected by oliverfoggin
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