Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates API documentation based on technical writing suggestions. #146

Merged
merged 5 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/SwiftCurrent/Models/Workflow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Foundation
A doubly linked list of `FlowRepresentableMetadata`s; used to define a process.

### Discussion
In a sufficiently complex application it may make sense to create a structure to hold onto all the workflows in an application.
In a sufficiently complex application, it may make sense to create a structure to hold onto all the workflows in an application.

#### Example
```swift
Expand Down
12 changes: 6 additions & 6 deletions Sources/SwiftCurrent/Protocols/FlowRepresentable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import Foundation
```

#### Note
Declaring your own custom initializer can result in a compiler error with an unfriendly message
Declaring your own custom initializer can result in a compiler error with an unfriendly message.
```swift
class FR1: FlowRepresentable { // Results in compiler error for 'init()' being unavailable
weak var _workflowPointer: AnyFlowRepresentable?
Expand All @@ -56,19 +56,19 @@ public protocol FlowRepresentable {
A pointer to the `AnyFlowRepresentable` that erases this `FlowRepresentable`; will automatically be set.

### Discussion
This property is automatically set by a `Workflow`, it simply needs to be declared on a `FlowRepresentable`.
In order for a `FlowRepresentable` to have access to the `Workflow` that launched it, store the closures for proceeding forward and backward, and provide type safety, it needs this property available for writing.
This property is automatically set by a `Workflow`; it simply needs to be declared on a `FlowRepresentable`.
In order for a `FlowRepresentable` to have access to the `Workflow` that launched it, store the closures for proceeding forward and backward, and provide type safety. It needs this property available for writing.

#### Note
While not strictly necessary it would be wise to declare this property as `weak`.
While not strictly necessary, it would be wise to declare this property as `weak`.
*/
var _workflowPointer: AnyFlowRepresentable? { get set }

/**
Creates a `FlowRepresentable`.

#### Note
This is auto synthesized by FlowRepresentable, and is only called when `WorkflowInput` is `Never`.
This is auto-synthesized by FlowRepresentable, and is only called when `WorkflowInput` is `Never`.
*/
init()
/// Creates a `FlowRepresentable` with the specified `WorkflowInput`.
Expand All @@ -87,7 +87,7 @@ public protocol FlowRepresentable {
### Discussion
This method is called *after* `init` but *before* any other lifecycle events. It is non-mutating and should not change the `FlowRepresentable`.

- Important: If you create a superclass that is a `FlowRepresentable` and expect subclasses to define their own `shouldLoad` the superclass should declare `shouldLoad`, and the subclasses should override it. Otherwise you will find the subclasses do not behave as expected.
- Important: If you create a superclass that is a `FlowRepresentable` and expect subclasses to define their own `shouldLoad`, the superclass should declare `shouldLoad`, and the subclasses should override it. Otherwise you will find the subclasses do not behave as expected.

#### Note
Returning `false` can have different behaviors depending on the `FlowPersistence`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ extension UIViewController {

extension FlowRepresentable where Self: UIViewController {
/**
Called when the current workflow should be terminated, and the app should return to the point before the workflow was launched
- Parameter animated: A boolean indicating whether abandoning the workflow should be animated
- Parameter onFinish: A callback after the workflow has been abandoned.
- Note: In order to dismiss UIKit views the workflow must have an `OrchestrationResponder` that is a `UIKitPresenter`.
Called when the current workflow should be terminated, and the app should return to the point before the workflow was launched.
- Parameter animated: a boolean indicating whether abandoning the workflow should be animated.
- Parameter onFinish: a callback after the workflow has been abandoned.
- Note: In order to dismiss UIKit views, the workflow must have an `OrchestrationResponder` that is a `UIKitPresenter`.
*/
public func abandonWorkflow(animated: Bool = true, onFinish:(() -> Void)? = nil) {
workflow?.abandon(animated: animated, onFinish: onFinish)
Expand Down