Skip to content
This repository was archived by the owner on Oct 17, 2024. It is now read-only.

Commit bd8d85a

Browse files
committed
Solve error that occurs while loading default function groups
1 parent 7c26e04 commit bd8d85a

2 files changed

Lines changed: 32 additions & 37 deletions

File tree

Sources/ActionKit/Model/Extensions/Array+.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Foundation
1111
extension Array where Element == Folder<Function> {
1212

1313
/// A set of functions for ``ControlFlow`` (Control Flow).
14-
public static var controlFlowFunctions: Self {
14+
public static let controlFlowFunctions: Self =
1515
[
1616
.init(
1717
.init(
@@ -25,10 +25,9 @@ extension Array where Element == Folder<Function> {
2525
for function in controlFlowConversionFunctions { function }
2626
}
2727
]
28-
}
2928

3029
/// Convert the control flow into other types.
31-
@ArrayBuilder<Function> public static var controlFlowConversionFunctions: [Function] {
30+
public static let controlFlowConversionFunctions: [Function] = [
3231
Function(
3332
id: .controlFlowToBoolean,
3433
name: .init(localized: .init(
@@ -44,10 +43,10 @@ extension Array where Element == Folder<Function> {
4443
) { input in
4544
[(input.first as? ControlFlow ?? .noSignal) == .signal]
4645
}
47-
}
46+
]
4847

4948
/// The group of the merge flow functions.
50-
public static var mergeFlowGroup: Self {
49+
public static let mergeFlowGroup: Self =
5150
[
5251
.init(
5352
.init(
@@ -61,7 +60,6 @@ extension Array where Element == Folder<Function> {
6160
for function in mergeFlowFunctions { function }
6261
}
6362
]
64-
}
6563

6664
/// The functions for merging the flow
6765
/// of ``String`` (Text), ``Double`` (Number), ``Bool`` (Boolean) and ``ControlFlow`` (Control Flow).

Sources/ActionKit/Model/Extensions/Array.swift

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ extension Array where Element == Folder<Function> {
1212

1313
/// A set of functions for the default types ``String`` (Text), ``Double`` (Number), ``Bool`` (Boolean)
1414
/// and ``ControlFlow`` (Control Flow).
15-
public static var `default`: Self {
16-
numberFunctions + textFunctions + booleanFunctions + controlFlowFunctions + mergeFlowGroup
17-
}
15+
public static let `default`
16+
=
17+
numberFunctions + textFunctions + booleanFunctions + controlFlowFunctions + mergeFlowGroup
1818

1919
/// A set of functions for ``Double`` (Number).
20-
public static var numberFunctions: Self {
20+
public static let numberFunctions: Self =
2121
[
2222
.init(
2323
.init(
@@ -53,10 +53,9 @@ extension Array where Element == Folder<Function> {
5353
for function in numberConversionFunctions { function }
5454
}
5555
]
56-
}
5756

5857
/// Operators for numbers as functions.
59-
@ArrayBuilder<Function> public static var numberOperatorsFunctions: [Function] {
58+
public static let numberOperatorsFunctions: [Function] = [
6059
Function(
6160
id: .addNumbers,
6261
name: .init(localized: .init("Add Numbers", comment: "Array (Function for adding two numbers)")),
@@ -70,7 +69,7 @@ extension Array where Element == Folder<Function> {
7069
]
7170
) { input in
7271
[(input.first as? Double ?? 0) + (input[safe: 1] as? Double ?? 0)]
73-
}
72+
},
7473
Function(
7574
id: .subtractNumbers,
7675
name: .init(localized: .init("Subtract Numbers", comment: "Array (Function for subtracting two numbers)")),
@@ -90,7 +89,7 @@ extension Array where Element == Folder<Function> {
9089
]
9190
) { input in
9291
[(input.first as? Double ?? 0) - (input[safe: 1] as? Double ?? 0)]
93-
}
92+
},
9493
Function(
9594
id: .multiplyNumbers,
9695
name: .init(localized: .init("Multiply Numbers", comment: "Array (Function for multiplying two numbers)")),
@@ -110,7 +109,7 @@ extension Array where Element == Folder<Function> {
110109
]
111110
) { input in
112111
[(input.first as? Double ?? 1) * (input[safe: 1] as? Double ?? 1)]
113-
}
112+
},
114113
Function(
115114
id: .divideNumbers,
116115
name: .init(localized: .init("Divide Numbers", comment: "Array (Function for dividing two numbers)")),
@@ -133,10 +132,10 @@ extension Array where Element == Folder<Function> {
133132
number2 = number2 == 0 ? 1 : number2
134133
return [(input.first as? Double ?? 1) / (number2)]
135134
}
136-
}
135+
]
137136

138137
/// Check relations of numbers as functions.
139-
@ArrayBuilder<Function> public static var numberRelationsFunctions: [Function] {
138+
public static let numberRelationsFunctions: [Function] = [
140139
Function(
141140
id: .equalNumbers,
142141
name: .init(localized: .init("Equal", comment: "Array (Function for checking if two numbers are equal)")),
@@ -153,7 +152,7 @@ extension Array where Element == Folder<Function> {
153152
]
154153
) { input in
155154
[(input.first as? Double ?? 0) == (input[safe: 1] as? Double ?? 0)]
156-
}
155+
},
157156
Function(
158157
id: .greaterThan,
159158
name: .init(localized: .init(
@@ -169,10 +168,10 @@ extension Array where Element == Folder<Function> {
169168
) { input in
170169
[(input.first as? Double ?? 0) > (input[safe: 1] as? Double ?? 0)]
171170
}
172-
}
171+
]
173172

174173
/// Convert numbers into other types.
175-
@ArrayBuilder<Function> public static var numberConversionFunctions: [Function] {
174+
public static let numberConversionFunctions: [Function] = [
176175
Function(
177176
id: .numberToText,
178177
name: .init(localized: .init(
@@ -193,10 +192,10 @@ extension Array where Element == Folder<Function> {
193192
}
194193
return [String(number)]
195194
}
196-
}
195+
]
197196

198197
/// A set of functions for ``String`` (Text).
199-
public static var textFunctions: Self {
198+
public static let textFunctions: Self =
200199
[
201200
.init(
202201
.init(
@@ -232,10 +231,9 @@ extension Array where Element == Folder<Function> {
232231
for function in textConversionFunctions { function }
233232
}
234233
]
235-
}
236234

237235
/// Operators for text as functions.
238-
@ArrayBuilder<Function> public static var textOperatorsFunctions: [Function] {
236+
public static let textOperatorsFunctions: [Function] = [
239237
Function(
240238
id: .addText,
241239
name: .init(localized: .init("Add Text", comment: "Array (Function for adding two text snippets)")),
@@ -253,10 +251,10 @@ extension Array where Element == Folder<Function> {
253251
) { input in
254252
[(input.first as? String ?? "") + (input[safe: 1] as? String ?? "")]
255253
}
256-
}
254+
]
257255

258256
/// Check relations of text as functions.
259-
@ArrayBuilder<Function> public static var textRelationsFunctions: [Function] {
257+
public static let textRelationsFunctions: [Function] = [
260258
Function(
261259
id: .equalText,
262260
name: .init(localized: .init(
@@ -277,10 +275,10 @@ extension Array where Element == Folder<Function> {
277275
) { input in
278276
[(input.first as? String ?? "") == (input[safe: 1] as? String ?? "")]
279277
}
280-
}
278+
]
281279

282280
/// Convert text into other types.
283-
@ArrayBuilder<Function> public static var textConversionFunctions: [Function] {
281+
public static let textConversionFunctions: [Function] = [
284282
Function(
285283
id: .textToNumber,
286284
name: .init(localized: .init(
@@ -296,10 +294,10 @@ extension Array where Element == Folder<Function> {
296294
) { input in
297295
[Double(input.first as? String ?? "") ?? 0]
298296
}
299-
}
297+
]
300298

301299
/// A set of functions for ``Bool`` (Boolean).
302-
public static var booleanFunctions: Self {
300+
public static let booleanFunctions: Self =
303301
[
304302
.init(
305303
.init(
@@ -324,10 +322,9 @@ extension Array where Element == Folder<Function> {
324322
for function in booleanConversionFunctions { function }
325323
}
326324
]
327-
}
328325

329326
/// Logical operators functions.
330-
@ArrayBuilder<Function> public static var logicalOperatorsFunctions: [Function] {
327+
public static let logicalOperatorsFunctions: [Function] = [
331328
Function(
332329
id: .and,
333330
name: .init(localized: .init(
@@ -342,7 +339,7 @@ extension Array where Element == Folder<Function> {
342339
output: [.init(.boolean, type: Bool.self)]
343340
) { input in
344341
[(input.first as? Bool ?? false) && (input[safe: 1] as? Bool ?? false)]
345-
}
342+
},
346343
Function(
347344
id: .orOperator,
348345
name: .init(localized: .init(
@@ -357,7 +354,7 @@ extension Array where Element == Folder<Function> {
357354
output: [.init(.boolean, type: Bool.self)]
358355
) { input in
359356
[(input.first as? Bool ?? false) || (input[safe: 1] as? Bool ?? false)]
360-
}
357+
},
361358
Function(
362359
id: .not,
363360
name: .init(localized: .init(
@@ -373,10 +370,10 @@ extension Array where Element == Folder<Function> {
373370
) { input in
374371
[!(input.first as? Bool ?? true)]
375372
}
376-
}
373+
]
377374

378375
/// Convert booleans into other types.
379-
@ArrayBuilder<Function> public static var booleanConversionFunctions: [Function] {
376+
public static let booleanConversionFunctions: [Function] = [
380377
Function(
381378
id: .booleanToControlFlow,
382379
name: .init(localized: .init(
@@ -392,6 +389,6 @@ extension Array where Element == Folder<Function> {
392389
) { input in
393390
[(input.first as? Bool ?? false) ? ControlFlow.signal : ControlFlow.noSignal]
394391
}
395-
}
392+
]
396393

397394
}

0 commit comments

Comments
 (0)