diff --git a/.github/abstract/Creating Workflows.md b/.github/abstract/Creating Workflows.md index 090feba61..b9d0a267e 100644 --- a/.github/abstract/Creating Workflows.md +++ b/.github/abstract/Creating Workflows.md @@ -1,12 +1,12 @@ -### What is a workflow? -A `Workflow` is a description for a sequence of `FlowRepresentable`s. Those operations are normally displaying screens or views. There are different ways of [creating workflows in SwiftUI](Creating%20Workflows%20in%20SwiftUI.html) and [creating workflows in UIKit](Creating%20Workflows%20in%20UIKit.html). +### What is a Workflow? +A `Workflow` is a description for a sequence of `FlowRepresentable`s. Those operations normally display screens or views. There are different ways of [creating workflows in SwiftUI](Creating%20Workflows%20in%20SwiftUI.html) and [creating workflows in UIKit](Creating%20Workflows%20in%20UIKit.html). -### What is a `FlowRepresentable`? -A `FlowRepresentable` is a protocol that describes a type that can appear in a `Workflow`. It optionally declares `FlowRepresentable.WorkflowInput` and `FlowRepresentable.WorkflowOutput`, indicating whether it requires data or passes data forward. It also provides an initializer so that it can be created by the `Workflow`. Once an item conforms to `FlowRepresentable`, it can be injected into any `Workflow`. +### What Is a `FlowRepresentable`? +A `FlowRepresentable` is a protocol that describes a type that can appear in a `Workflow`. It optionally declares `FlowRepresentable.WorkflowInput` and `FlowRepresentable.WorkflowOutput`, indicating if it requires data or passes data forward. It also provides an initializer so that it can be created by the `Workflow`. Once an item conforms to `FlowRepresentable`, it can be injected into any `Workflow`. -### Valid workflow sequences +### Valid Workflow Sequences Workflows enforce (either at compile-time or run-time) that the sequence of `FlowRepresentables` is well-formed. For example, if a particular `FlowRepresentable` has a `FlowRepresentable.WorkflowInput` of `String`, but the previous item passes an `Int` forward, that workflow is malformed. A `FlowRepresentable` can declare a `FlowRepresentable.WorkflowInput` of `Never` if it does not take in data, `Any` if it can intake multiple types, or `AnyWorkflow.PassedArgs` if it can handle being passed no data, or data of any kind. Lastly, if your `FlowRepresentable.WorkflowInput` needs to take in multiple values, you can use a tuple. -In some cases, like UIKit, the compiler is efficient enough to give you compile-time feedback on whether a workflow is malformed. This means that runtime errors are rare. They can still occur, for example if you have Item1 declare a `FlowRepresentable.WorkflowOutput` of `AnyWorkflow.PassedArgs`, then call `FlowRepresentable.proceedInWorkflow(_:)` with `.args("string")`, but Item2 has a `FlowRepresentable.WorkflowInput` of `Int` there'll be a runtime error because the data passed forward does not meet expectations. +In some cases, like UIKit, the compiler is efficient enough to give you compile-time feedback if a workflow is malformed. This means that run-time errors are rare. They can still occur; for example, if you have Item1 declare a `FlowRepresentable.WorkflowOutput` of `AnyWorkflow.PassedArgs`, then call `FlowRepresentable.proceedInWorkflow(_:)` with `.args("string")`, but Item2 has a `FlowRepresentable.WorkflowInput` of `Int`, there'll be a run-time error because the data passed forward does not meet expectations. -In SwiftUI, the compiler was not efficient enough to give the same compile-time feedback on malformed workflows. When that safety was added, the compiler only allowed for small workflows to be created. To combat this, SwiftUI is heavily run-time influenced. When you create a `WorkflowLauncher`, the launcher performs a runtime check to guarantee the workflow is well-formed. This means that if you wanted to test your workflow was well-formed, all you have to do is instantiate a `WorkflowLauncher`. \ No newline at end of file +In SwiftUI, the compiler was not efficient enough to give the same compile-time feedback on malformed workflows. When that safety was added, the compiler only allowed for small workflows to be created. To combat this, SwiftUI is heavily run-time influenced. When you create a `WorkflowLauncher`, the launcher performs a run-time check to guarantee the workflow is well-formed. This means that if you wanted to test your workflow was well-formed, all you have to do is instantiate a `WorkflowLauncher`.