Skip to content

Commit

Permalink
Merge pull request #24 from wwt/documentation-updates
Browse files Browse the repository at this point in the history
Updates README.md to be more compelling
  • Loading branch information
brianlombardo committed May 27, 2021
2 parents f09bfab + d7462a9 commit 8733a5a
Show file tree
Hide file tree
Showing 76 changed files with 843 additions and 309 deletions.
76 changes: 46 additions & 30 deletions README.md
Expand Up @@ -3,42 +3,58 @@
![Quality Gate](https://img.shields.io/sonar/quality_gate/wwt_Workflow?server=https%3A%2F%2Fsonarcloud.io)
![Coverage](https://img.shields.io/sonar/coverage/wwt_Workflow?server=http%3A%2F%2Fsonarcloud.io)

### Welcome to Workflow!
Workflow is a library meant to handle complex user flows in iOS applications.
# Welcome
Workflow is a library that lets you easily manage journeys through your Swift application.

#### Table of Contents:
- [Installation](https://github.com/wwt/Workflow/wiki/Installation)
- [Why Workflow?](https://github.com/wwt/Workflow/wiki/Why-This-Library%3F)
- [Getting Started](https://github.com/wwt/Workflow/wiki/getting-started)
- [Testing Your Workflows](https://github.com/wwt/Workflow/wiki/testing)
- [Advanced](https://github.com/wwt/Workflow/wiki/advanced)
- [Developer Documentation](https://gitcdn.link/repo/wwt/Workflow/main/docs/index.html)
- [Upgrade Path](https://github.com/wwt/Workflow/blob/main/UPGRADE_PATH.md)
- [FAQ](https://github.com/wwt/Workflow/wiki/faq)
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 problem Workflow was built to solve:
When developing for iOS one view controller has to know about the one following it in order to pass along data. Imagine a workflow for a fast food app.

Pick a location -> Pickup or Delivery -> Catering Menu or Normal Menu -> Choose Food -> Review Order -> Submit payment

Now imagine if a users location is known via GPS. You may be able to skip the first screen and assume the nearest location knowing they can edit it on the review screen. Pickup or Delivery may or may not need to show up depending on what the location they picked supports. The same is true with catering menu vs normal menu
```swift
let workflow = Workflow(LocationsViewController.self) // Skip this if you have GPS
.thenProceed(with: PickupOrDeliveryViewController.self) // Skip this if you only have 1 choice
.thenProceed(with: MenuSelectionViewController.self) // Skip this for new stores
.thenProceed(with: FoodSelectionViewController.self)
.thenProceed(with: ReviewOrderViewController.self) // This lets you edit anything you've already picked
.thenProceed(with: SubmitPaymentViewController.self)

Finally the review screen would be really nice if it gave a way to edit. This spells a nightmare for you if you utilize segues. You'll have to use many of them, and if the design of this user flow changes you're in for a bit of an annoying time changing them around.
// from wherever this flow is launched
launchInto(workflow)
```
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](https://gitcdn.link/cdn/wwt/Workflow/faf9273f154954848bf6b6d5c592a7f0740ef53a/docs/Classes/Workflow.html).

### The solution
Workflow lets you specify once what the whole workflow looks like, then each view controller defines whether it should show up or not, so to solve the above problem you'd use something like this.
## Interested but you need SwiftUI support?
[We're working on it now!](https://github.com/wwt/Workflow/milestone/2)

# Quick Start
## CocoaPods
```ruby
pod 'DynamicWorkflow/UIKit'
```
Then make your first FlowRepresentable view controller:
```swift
let workflow = Workflow(LocationsViewController.self)
.thenPresent(PickupOrDeliveryViewController.self)
.thenPresent(MenuSelectionViewController.self)
.thenPresent(FoodSelectionViewController.self)
.thenPresent(ReviewOrderViewController.self)
.thenPresent(SubmitPaymentViewController.self)

// from wherever this flow is launched
launchInto(workflow)
import Workflow
class ExampleViewController: UIWorkflowItem<Never, Never>, FlowRepresentable {
override func viewDidLoad() {
view.backgroundColor = .green
}
}
```
Then from your root view controller, call:
```swift
import Workflow
...
launchInto(Workflow(ExampleViewController.self))
```

And just like that you're started! To see something more practical and in-depth, check out the example app in the repo. For a more in-depth starting guide, checkout out our [Getting Started](https://github.com/wwt/Workflow/wiki/getting-started) documentation.

If you ever want to re-order these you simply move their position in the chain. Your view controllers will naturally start to become defined in a way where they can be injected into any kind of workflow, and so if for scheduled orders you want screens to show up in a different order, you just define a new `Workflow`.
# Deep Dive
- [Why Workflow?](https://github.com/wwt/Workflow/wiki/Why-This-Library%3F)
- [Installation](https://github.com/wwt/Workflow/wiki/Installation)
- [Getting Started](https://github.com/wwt/Workflow/wiki/getting-started)
- [Testing Your Workflows](https://github.com/wwt/Workflow/wiki/testing)
- [Advanced](https://github.com/wwt/Workflow/wiki/advanced)
- [Developer Documentation](https://gitcdn.link/repo/wwt/Workflow/main/docs/index.html)
- [Upgrade Path](https://github.com/wwt/Workflow/blob/main/UPGRADE_PATH.md)
- [FAQ](https://github.com/wwt/Workflow/wiki/faq)
8 changes: 4 additions & 4 deletions STYLEGUIDE.md
Expand Up @@ -12,7 +12,7 @@ Note that brevity is not a primary goal. Code should be made more concise only i

## Guiding Tenets

* The [official swift API design guidelines](https://swift.org/documentation/api-design-guidelines/) are all unilaterally accepted for any public API and generally have good information for private or internal APIs. If you are not making a public API we do not require the same level of documentation, but the naming conventions and general design guidelines are still great and should be adhered to.
* The [official Swift API design guidelines](https://swift.org/documentation/api-design-guidelines/) are all unilaterally accepted for any public API and generally have good information for private or internal APIs. If you are not making a public API we do not require the same level of documentation, but we still recommend that you adhere to the naming conventions and general design guidelines.
* These rules should not fight Xcode's <kbd>^</kbd> + <kbd>I</kbd> indentation behavior.
* We strive to make rules lintable:
* If a rule changes the format of the code, it needs to be able to be reformatted automatically using [SwiftLint](https://github.com/realm/SwiftLint).
Expand Down Expand Up @@ -1923,7 +1923,7 @@ Each guide is broken into a few sections. Sections contain a list of guidelines.
<details>

#### Why?
Remember, implicitly unwrapped optionals are a thing if you can safely assume a value. A core component to swift is its safety, don't ruin that safety just for conveniences sake.
Remember, implicitly unwrapped optionals are a thing if you can safely assume a value. A core component to Swift is its safety, don't ruin that safety just for conveniences sake.

```swift
// WRONG
Expand Down Expand Up @@ -2354,6 +2354,6 @@ Each guide is broken into a few sections. Sections contain a list of guidelines.

## Attribution:
- This styleguide was forked from the [AirBnB styleguide](https://github.com/airbnb/swift). Thanks AirBnB!
- Inspiration on format also came from [the effective dart docs](https://dart.dev/guides/language/effective-dart), Thanks google!
- Parts of the styleguide also inspired by [the google swift styleguide](https://google.github.io/swift/#defining-new-operators), Thanks google!
- Inspiration on format also came from [the effective dart docs](https://dart.dev/guides/language/effective-dart), Thanks Google!
- Parts of the styleguide also inspired by [the Google Swift styleguide](https://google.github.io/swift/#defining-new-operators), Thanks Google!
- Parts of the styleguide also inspired by [The Official raywenderlich.com Swift Style Guide](https://github.com/raywenderlich/swift-style-guide), Thanks Ray Wenderlich!
6 changes: 3 additions & 3 deletions docs/Classes.html
Expand Up @@ -21,7 +21,7 @@
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="index.html">
Workflow 3.0.1 Docs
Workflow 3.0.3 Docs
</a>
(92% documented)
</p>
Expand Down Expand Up @@ -226,8 +226,8 @@ <h1>Classes</h1>
</article>
</div>
<section class="footer">
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-23)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.7</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-27)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/Classes/AnyFlowRepresentable.html
Expand Up @@ -21,7 +21,7 @@
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
Workflow 3.0.1 Docs
Workflow 3.0.3 Docs
</a>
(92% documented)
</p>
Expand Down Expand Up @@ -237,8 +237,8 @@ <h4>Parameters</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-23)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.7</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-27)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/Classes/AnyWorkflow.html
Expand Up @@ -21,7 +21,7 @@
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
Workflow 3.0.1 Docs
Workflow 3.0.3 Docs
</a>
(92% documented)
</p>
Expand Down Expand Up @@ -315,8 +315,8 @@ <h4>Parameters</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-23)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.7</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-27)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/Classes/AnyWorkflow/Element.html
Expand Up @@ -21,7 +21,7 @@
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../../index.html">
Workflow 3.0.1 Docs
Workflow 3.0.3 Docs
</a>
(92% documented)
</p>
Expand Down Expand Up @@ -148,8 +148,8 @@ <h1>Element</h1>
</article>
</div>
<section class="footer">
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-23)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.7</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-27)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/Classes/AnyWorkflow/PassedArgs.html
Expand Up @@ -21,7 +21,7 @@
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../../index.html">
Workflow 3.0.1 Docs
Workflow 3.0.3 Docs
</a>
(92% documented)
</p>
Expand Down Expand Up @@ -256,8 +256,8 @@ <h4>Return Value</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-23)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.7</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-27)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/Classes/FlowPersistence.html
Expand Up @@ -21,7 +21,7 @@
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
Workflow 3.0.1 Docs
Workflow 3.0.3 Docs
</a>
(92% documented)
</p>
Expand Down Expand Up @@ -291,8 +291,8 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-23)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.7</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-27)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/Classes/FlowRepresentableMetadata.html
Expand Up @@ -21,7 +21,7 @@
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
Workflow 3.0.1 Docs
Workflow 3.0.3 Docs
</a>
(92% documented)
</p>
Expand Down Expand Up @@ -281,8 +281,8 @@ <h4>Parameters</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-23)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.7</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-27)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/Classes/LaunchStyle.html
Expand Up @@ -21,7 +21,7 @@
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
Workflow 3.0.1 Docs
Workflow 3.0.3 Docs
</a>
(92% documented)
</p>
Expand Down Expand Up @@ -222,8 +222,8 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-23)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.7</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-27)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/Classes/LaunchStyle/PresentationType.html
Expand Up @@ -21,7 +21,7 @@
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../../index.html">
Workflow 3.0.1 Docs
Workflow 3.0.3 Docs
</a>
(92% documented)
</p>
Expand Down Expand Up @@ -334,8 +334,8 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-23)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.7</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2021 <a class="link" href="https://github.com/wwt/workflow" target="_blank" rel="external">WWT and Tyler Thompson</a>. All rights reserved. (Last updated: 2021-05-27)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
Expand Down

0 comments on commit 8733a5a

Please sign in to comment.