Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ internal final class {{ worker_name }}WorkerImp: AbstractWorker
{{ cancellable_type }}
> {

/// The Analytics instance.
private let analytics: {{ node_name }}Analytics

/// The initializer.
/// - Parameter analytics: The Analytics instance
internal init(analytics: {{ node_name }}Analytics) {
self.analytics = analytics
}
internal init() {}

/// Implement logic to execute when the Worker is started.
override internal func didStart() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
public struct WorkerContext: Context {

private let fileHeader: String
private let nodeName: String
private let workerName: String
private let workerImports: [String]
private let cancellableType: String

internal var dictionary: [String: Any] {
[
"file_header": fileHeader,
"node_name": nodeName,
"worker_name": workerName,
"worker_imports": workerImports,
"cancellable_type": cancellableType
Expand All @@ -25,13 +23,11 @@ public struct WorkerContext: Context {

public init(
fileHeader: String,
nodeName: String,
workerName: String,
workerImports: Set<String>,
cancellableType: String
) {
self.fileHeader = fileHeader
self.nodeName = nodeName
self.workerName = workerName
self.workerImports = workerImports.sortedImports()
self.cancellableType = cancellableType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,13 @@ internal struct WorkerTemplate: XcodeTemplate {
Option(identifier: "productName",
name: "Worker name:",
description: "The name of the Worker")
Option(identifier: "nodeName",
name: "Node name:",
description: "The name of the Node")
}

internal init(config: Config) {
let worker: StencilTemplate = .worker
stencils = [worker]
context = WorkerContext(
fileHeader: config.fileHeader,
nodeName: config.variable("nodeName"),
workerName: config.variable("productName"),
workerImports: worker.imports(config: config),
cancellableType: config.cancellableType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ extension TestFactories {
func givenWorkerContext() -> WorkerContext {
WorkerContext(
fileHeader: "<fileHeader>",
nodeName: "<nodeName>",
workerName: "<workerName>",
workerImports: ["<workerImports>"],
cancellableType: "<cancellableType>"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
5 key/value pairs
4 key/value pairs
▿ (2 elements)
- key: "cancellable_type"
- value: "<cancellableType>"
▿ (2 elements)
- key: "file_header"
- value: "<fileHeader>"
▿ (2 elements)
- key: "node_name"
- value: "<nodeName>"
▿ (2 elements)
- key: "worker_imports"
▿ value: 1 element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ internal final class <workerName>WorkerImp: AbstractWorker
<cancellableType>
> {

/// The Analytics instance.
private let analytics: <nodeName>Analytics

/// The initializer.
/// - Parameter analytics: The Analytics instance
internal init(analytics: <nodeName>Analytics) {
self.analytics = analytics
}
internal init() {}

/// Implement logic to execute when the Worker is started.
override internal func didStart() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
▿ context: WorkerContext
- cancellableType: "<cancellableType>"
- fileHeader: "<fileHeader>"
- nodeName: "___VARIABLE_nodeName___"
▿ workerImports: 3 elements
- "<baseImports>"
- "<reactiveImports>"
Expand All @@ -15,7 +14,7 @@
- description: "The source file implementing a Worker."
- kind: "Xcode.IDEFoundation.TextSubstitutionFileTemplateKind"
- mainTemplateFile: "___FILEBASENAME___.swift"
▿ options: 2 elements
▿ options: 1 element
▿ Option
- default: Optional<String>.none
- description: "The name of the Worker"
Expand All @@ -24,14 +23,6 @@
- notPersisted: true
- required: true
- type: "text"
▿ Option
- default: Optional<String>.none
- description: "The name of the Node"
- identifier: "nodeName"
- name: "Node name:"
- notPersisted: true
- required: true
- type: "text"
- platforms: 0 elements
- sortOrder: 9
- summary: "The source file implementing a Worker"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,6 @@
<key>Type</key>
<string>text</string>
</dict>
<dict>
<key>Description</key>
<string>The name of the Node</string>
<key>Identifier</key>
<string>nodeName</string>
<key>Name</key>
<string>Node name:</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
</dict>
</array>
<key>Platforms</key>
<array/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@ internal final class ___VARIABLE_productName___WorkerImp: AbstractWorker
AnyCancellable
> {

/// The Analytics instance.
private let analytics: ___VARIABLE_nodeName___Analytics

/// The initializer.
/// - Parameter analytics: The Analytics instance
internal init(analytics: ___VARIABLE_nodeName___Analytics) {
self.analytics = analytics
}
internal init() {}

/// Implement logic to execute when the Worker is started.
override internal func didStart() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,6 @@
<key>Type</key>
<string>text</string>
</dict>
<dict>
<key>Description</key>
<string>The name of the Node</string>
<key>Identifier</key>
<string>nodeName</string>
<key>Name</key>
<string>Node name:</string>
<key>NotPersisted</key>
<true/>
<key>Required</key>
<true/>
<key>Type</key>
<string>text</string>
</dict>
</array>
<key>Platforms</key>
<array/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@ internal final class ___VARIABLE_productName___WorkerImp: AbstractWorker
AnyCancellable
> {

/// The Analytics instance.
private let analytics: ___VARIABLE_nodeName___Analytics

/// The initializer.
/// - Parameter analytics: The Analytics instance
internal init(analytics: ___VARIABLE_nodeName___Analytics) {
self.analytics = analytics
}
internal init() {}

/// Implement logic to execute when the Worker is started.
override internal func didStart() {}
Expand Down