Skip to content

External actions to influence state #509

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

You must be logged in to vote

@DavidKmn This is where the environment comes into play. We have a web socket example here:

https://github.com/pointfreeco/swift-composable-architecture/blob/4449bc2e249ba909086271d37b98f54e0ce725e3/Examples/CaseStudies/SwiftUICaseStudies/02-Effects-WebSocket.swift

It uses a connectButtonTapped to kick things off, but you could also tie it to a lifecycle event like onAppear or applicationDidFinishLaunching.

Replies: 1 comment 2 replies

Comment options

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

@lukeredpath
Comment options

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