Skip to content

Commit

Permalink
Merge pull request #51 from wwt/installation-enhancements
Browse files Browse the repository at this point in the history
Enhances clarity and accuracy of Installation guide
  • Loading branch information
wiemerm authored Jun 16, 2021
2 parents 085fd20 + 2aa31dd commit 6d02d43
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 26 deletions.
6 changes: 5 additions & 1 deletion wiki/Getting-Started-UIKit.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ Start by cloning the repo and checking out the 'SwiftCurrentExample' scheme. Thi

## Adding the dependency

For instructions on SPM and CocoaPods, [check out our intstallation page.](https://github.com/wwt/SwiftCurrent/wiki/Installation#swift-package-manager)
For instructions on SPM and CocoaPods, [check out our installation page.](https://github.com/wwt/SwiftCurrent/wiki/Installation#swift-package-manager)

## Create your view controllers

Create two view controllers that inherit from [UIWorkflowItem<I, O>](https://github.io/SwiftCurrent/Classes/UIWorkflowItem.html).

```swift
import UIKit
import SwiftCurrent
import SwiftCurrent_UIKit

class FirstViewController: UIWorkflowItem<String, String>, FlowRepresentable {
Expand Down Expand Up @@ -203,6 +204,7 @@ class SecondViewControllerTests: XCTestCase {
}

func testProceedPassesThroughInput() {
// Arrange
var proceedInWorkflowCalled = false
let expectedString = "Awesome.Possum@wwt.com"
let ref = AnyFlowRepresentable(SecondViewController.self, args: .args(expectedString))
Expand All @@ -216,8 +218,10 @@ class SecondViewControllerTests: XCTestCase {
XCTAssertEqual(passedArgs.extractArgs(defaultValue: "defaultValue used") as? String, expectedString)
}

// Act
(testViewController.view.viewWithAccessibilityIdentifier("finish") as? UIButton)?.simulateTouch() // UIUTest helper

// Assert
XCTAssert(proceedInWorkflowCalled, "proceedInWorkflow should be called")
}
}
Expand Down
6 changes: 5 additions & 1 deletion wiki/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ Start by cloning the repo and checking out the 'SwiftCurrentExample' scheme. Thi

## Adding the dependency

For instructions on SPM and CocoaPods, [check out our intstallation page.](https://github.com/wwt/SwiftCurrent/wiki/Installation#swift-package-manager)
For instructions on SPM and CocoaPods, [check out our installation page.](https://github.com/wwt/SwiftCurrent/wiki/Installation#swift-package-manager)

## Create the convenience protocols for storyboard loading

It is best practice to use the [StoryboardLoadable](https://github.io/SwiftCurrent/Protocols/StoryboardLoadable.html) protocol to connect your [FlowRepresentable](https://github.io/SwiftCurrent/Protocols/FlowRepresentable.html) to your Storyboard. Additionally, to limit the amount of duplicate code, you can make a convenience protocol for each storyboard.

```swift
import UIKit
import SwiftCurrent_UIKit

extension StoryboardLoadable {
Expand Down Expand Up @@ -191,6 +192,7 @@ class SecondViewControllerTests: XCTestCase {
}

func testProceedPassesThroughInput() {
// Arrange
var proceedInWorkflowCalled = false
let expectedString = "Awesome.Possum@wwt.com"
let ref = AnyFlowRepresentable(SecondViewController.self, args: .args(expectedString))
Expand All @@ -204,8 +206,10 @@ class SecondViewControllerTests: XCTestCase {
XCTAssertEqual(passedArgs.extractArgs(defaultValue: "defaultValue used") as? String, expectedString)
}

// Act
(testViewController.view.viewWithAccessibilityIdentifier("finish") as? UIButton)?.simulateTouch() // UIUTest helper

// Assert
XCTAssert(proceedInWorkflowCalled, "proceedInWorkflow should be called")
}
}
Expand Down
29 changes: 5 additions & 24 deletions wiki/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Add the following line to the package dependencies

## Get the correct product

Add one one of the following products to your target dependencies.
Add the following products to your target dependencies.

#### **If you want to use SwiftCurrent with UIKit**

Expand All @@ -23,46 +23,27 @@ Add one one of the following products to your target dependencies.
.product(name: "SwiftCurrent_UIKit", package: "SwiftCurrent")
```

#### **Your import statement in this case will be**
#### **Your import statements for these products will be**

```swift
import SwiftCurrent
import SwiftCurrent_UIKit
```

`SwiftCurrent_UIKit` will need to target a platform that supports UIKit, such as iOS or macOS with Catalyst.

#### **If you want to use SwiftCurrent without UIKit**

```swift
.product(name: "SwiftCurrent", package: "SwiftCurrent"),
```
#### **Your import statement in this case will be**


```swift
import SwiftCurrent
```
`Note:` When using SwiftCurrent for a custom domain, you will need to build out the associated [Orchestration Responders](https://wwt.github.io/SwiftCurrent/Protocols/OrchestrationResponder.html).

# CocoaPods

Set up [CocoaPods](https://cocoapods.org/) for your project, then include SwiftCurrent in your dependencies by adding one of the following lines to your `Podfile`:
Set up [CocoaPods](https://cocoapods.org/) for your project, then include SwiftCurrent in your dependencies by adding the following line to your `Podfile`:

#### **If you want to use SwiftCurrent with UIKit**

```ruby
pod 'SwiftCurrent/UIKit'
```

#### **If you want to use SwiftCurrent without UIKit**

```ruby
pod 'SwiftCurrent/Core'
```

`Note:` When using SwiftCurrent for a custom domain, you will need to build out the associated [Orchestration Responders](https://wwt.github.io/SwiftCurrent/Protocols/OrchestrationResponder.html).

#### **In both of these cases your import statement will be**
#### **Your import statement will be**

```swift
import SwiftCurrent
Expand Down

0 comments on commit 6d02d43

Please sign in to comment.