When Developing in UIKit, each view controller has to know about the one following it in order to share data.  Now imagine a flow where the first 3 sc

wwt / SwiftCurrent

submited by
Style Pass
2021-08-16 15:00:08

When Developing in UIKit, each view controller has to know about the one following it in order to share data. Now imagine a flow where the first 3 screens are optional. What would it look like if you could decouple all of that?

The above code is all that is needed from the screen starting this flow. Each screen determines if it needs to show based on data passed in and what that screen knows about the system (such as GPS availability), and all of it is type safe. If you ever want to re-order these, simply move their position in the chain.

As you continue to develop your applications, each view controller will become more decoupled from the rest of the app. That means, if you want a completely different order of screens, just define a new Workflow.

If you would like to try the beta release, please install the BETA_SwiftCurrent_SwiftUI product in SPM or the BETA_SwiftUI sub spec in CocoaPods. For more detailed steps, see our installation instructions. See Getting Started with SwiftUI for a quick tutorial. To see the example app for SwiftUI, clone our repo, open SwiftCurrent.xcworkspace, target the SwiftUIExample scheme, and run. The example app has a README that details interesting usages.

Leave a Comment
Related Posts