Skip to content

Commit 154e4cf

Browse files
Merge pull request #100 from monishsyed/ms/update-templates
Updates to Workflow Templates
2 parents af191b3 + 733177f commit 154e4cf

File tree

6 files changed

+181
-19
lines changed

6 files changed

+181
-19
lines changed

Diff for: Tooling/Templates/Workflow (Verbose).xctemplate/___FILEBASENAME___Workflow.swift renamed to Tooling/Templates/Workflow (Verbose).xctemplate/Default/___FILEBASENAME___Workflow.swift

-18
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// ___FILEHEADER___
22

3-
import ReactiveSwift
43
import Workflow
5-
import WorkflowReactiveSwift
64
import WorkflowUI
75

86
// MARK: Input and Output
@@ -37,22 +35,6 @@ extension ___VARIABLE_productName___Workflow {
3735
}
3836
}
3937

40-
// MARK: Workers
41-
42-
extension ___VARIABLE_productName___Workflow {
43-
struct ___VARIABLE_productName___Worker: Worker {
44-
enum Output {}
45-
46-
func run() -> SignalProducer<Output, Never> {
47-
fatalError()
48-
}
49-
50-
func isEquivalent(to otherWorker: ___VARIABLE_productName___Worker) -> Bool {
51-
return true
52-
}
53-
}
54-
}
55-
5638
// MARK: Rendering
5739

5840
extension ___VARIABLE_productName___Workflow {

Diff for: Tooling/Templates/Workflow (Verbose).xctemplate/TemplateInfo.plist

+41-1
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,52 @@
1818
<key>Name</key>
1919
<string>Name:</string>
2020
<key>Description</key>
21-
<string>The name of the workflow to create. "Workflow" will be appended to the name.</string>
21+
<string>The name of the workflow to create. &quot;Workflow&quot; will be appended to the name.</string>
2222
<key>Type</key>
2323
<string>text</string>
2424
<key>Default</key>
2525
<string>HelloWorld</string>
2626
</dict>
27+
<dict>
28+
<key>Identifier</key>
29+
<string>generateWorker</string>
30+
<key>Required</key>
31+
<true/>
32+
<key>Name</key>
33+
<string>Also create a Worker</string>
34+
<key>Description</key>
35+
<string>Workers define a unit of asynchronous work</string>
36+
<key>Type</key>
37+
<string>checkbox</string>
38+
<key>Default</key>
39+
<string>false</string>
40+
</dict>
41+
<dict>
42+
<key>Identifier</key>
43+
<string>streamType</string>
44+
<key>Required</key>
45+
<true/>
46+
<key>Name</key>
47+
<string>Uses:</string>
48+
<key>Description</key>
49+
<string>Whether to use RxSwift or ReactiveSwift</string>
50+
<key>Type</key>
51+
<string>popup</string>
52+
<key>Default</key>
53+
<string>ReactiveSwift</string>
54+
<key>RequiredOptions</key>
55+
<dict>
56+
<key>generateWorker</key>
57+
<array>
58+
<string>true</string>
59+
</array>
60+
</dict>
61+
<key>Values</key>
62+
<array>
63+
<string>RxSwift</string>
64+
<string>ReactiveSwift</string>
65+
</array>
66+
</dict>
2767
</array>
2868
</dict>
2969
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// ___FILEHEADER___
2+
3+
import ReactiveSwift
4+
import Workflow
5+
import WorkflowReactiveSwift
6+
import WorkflowUI
7+
8+
// MARK: Workers
9+
10+
extension ___VARIABLE_productName___Workflow {
11+
struct ___VARIABLE_productName___Worker: Worker {
12+
enum Output {}
13+
14+
func run() -> SignalProducer<Output, Never> {
15+
fatalError()
16+
}
17+
18+
func isEquivalent(to otherWorker: ___VARIABLE_productName___Worker) -> Bool {
19+
return true
20+
}
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// ___FILEHEADER___
2+
3+
import Workflow
4+
import WorkflowUI
5+
6+
// MARK: Input and Output
7+
8+
struct ___VARIABLE_productName___Workflow: Workflow {
9+
enum Output {}
10+
}
11+
12+
// MARK: State and Initialization
13+
14+
extension ___VARIABLE_productName___Workflow {
15+
struct State {}
16+
17+
func makeInitialState() -> ___VARIABLE_productName___Workflow.State {
18+
return State()
19+
}
20+
21+
func workflowDidChange(from previousWorkflow: ___VARIABLE_productName___Workflow, state: inout State) {}
22+
}
23+
24+
// MARK: Actions
25+
26+
extension ___VARIABLE_productName___Workflow {
27+
enum Action: WorkflowAction {
28+
typealias WorkflowType = ___VARIABLE_productName___Workflow
29+
30+
func apply(toState state: inout ___VARIABLE_productName___Workflow.State) -> ___VARIABLE_productName___Workflow.Output? {
31+
switch self {
32+
// Update state and produce an optional output based on which action was received.
33+
}
34+
}
35+
}
36+
}
37+
38+
// MARK: Rendering
39+
40+
extension ___VARIABLE_productName___Workflow {
41+
// TODO: Change this to your actual rendering type
42+
typealias Rendering = String
43+
44+
func render(state: ___VARIABLE_productName___Workflow.State, context: RenderContext<___VARIABLE_productName___Workflow>) -> Rendering {
45+
#warning("Don't forget your render implementation and to return the correct rendering type!")
46+
return "This is likely not the rendering that you want to return"
47+
}
48+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// ___FILEHEADER___
2+
3+
import RxSwift
4+
import Workflow
5+
import WorkflowRxSwift
6+
import WorkflowUI
7+
8+
// MARK: Workers
9+
10+
extension ___VARIABLE_productName___Workflow {
11+
struct ___VARIABLE_productName___Worker: Worker {
12+
enum Output {}
13+
14+
func run() -> Observable<Output> {
15+
fatalError()
16+
}
17+
18+
func isEquivalent(to otherWorker: ___VARIABLE_productName___Worker) -> Bool {
19+
return true
20+
}
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// ___FILEHEADER___
2+
3+
import Workflow
4+
import WorkflowUI
5+
6+
// MARK: Input and Output
7+
8+
struct ___VARIABLE_productName___Workflow: Workflow {
9+
enum Output {}
10+
}
11+
12+
// MARK: State and Initialization
13+
14+
extension ___VARIABLE_productName___Workflow {
15+
struct State {}
16+
17+
func makeInitialState() -> ___VARIABLE_productName___Workflow.State {
18+
return State()
19+
}
20+
21+
func workflowDidChange(from previousWorkflow: ___VARIABLE_productName___Workflow, state: inout State) {}
22+
}
23+
24+
// MARK: Actions
25+
26+
extension ___VARIABLE_productName___Workflow {
27+
enum Action: WorkflowAction {
28+
typealias WorkflowType = ___VARIABLE_productName___Workflow
29+
30+
func apply(toState state: inout ___VARIABLE_productName___Workflow.State) -> ___VARIABLE_productName___Workflow.Output? {
31+
switch self {
32+
// Update state and produce an optional output based on which action was received.
33+
}
34+
}
35+
}
36+
}
37+
38+
// MARK: Rendering
39+
40+
extension ___VARIABLE_productName___Workflow {
41+
// TODO: Change this to your actual rendering type
42+
typealias Rendering = String
43+
44+
func render(state: ___VARIABLE_productName___Workflow.State, context: RenderContext<___VARIABLE_productName___Workflow>) -> Rendering {
45+
#warning("Don't forget your render implementation and to return the correct rendering type!")
46+
return "This is likely not the rendering that you want to return"
47+
}
48+
}

0 commit comments

Comments
 (0)