Skip to content

Commit be91dbf

Browse files
committed
Add element function
#70
1 parent dc01161 commit be91dbf

File tree

8 files changed

+26
-10
lines changed

8 files changed

+26
-10
lines changed

.github/workflows/swift.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
xcode-version:
15-
- /Applications/Xcode_15.3.app
15+
- /Applications/Xcode_16.3.app
1616

1717
steps:
1818
- uses: actions/checkout@v4

app/src/Outlander.xcodeproj/project.pbxproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@
911911
attributes = {
912912
BuildIndependentTargetsInParallel = YES;
913913
LastSwiftUpdateCheck = 1100;
914-
LastUpgradeCheck = 1530;
914+
LastUpgradeCheck = 1600;
915915
ORGANIZATIONNAME = "Joe McBride";
916916
TargetAttributes = {
917917
F9BCF2E922E177E100C7F7F0 = {
@@ -1501,7 +1501,6 @@
15011501
F9BCF30922E177E200C7F7F0 /* Debug */ = {
15021502
isa = XCBuildConfiguration;
15031503
buildSettings = {
1504-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
15051504
BUNDLE_LOADER = "$(TEST_HOST)";
15061505
CLANG_ENABLE_MODULES = YES;
15071506
CODE_SIGN_IDENTITY = "Apple Development";
@@ -1530,7 +1529,6 @@
15301529
F9BCF30A22E177E200C7F7F0 /* Release */ = {
15311530
isa = XCBuildConfiguration;
15321531
buildSettings = {
1533-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
15341532
BUNDLE_LOADER = "$(TEST_HOST)";
15351533
CLANG_ENABLE_MODULES = YES;
15361534
CODE_SIGN_IDENTITY = "Apple Development";

app/src/Outlander.xcodeproj/xcshareddata/xcschemes/Outlander.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1530"
3+
LastUpgradeVersion = "1600"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

app/src/Outlander.xcodeproj/xcshareddata/xcschemes/OutlanderTests.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1530"
3+
LastUpgradeVersion = "1600"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

app/src/Outlander/Infrastructure/EventBus.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
import Foundation
1010

11-
import Foundation
12-
1311
// source: https://github.com/cesarferreira/SwiftEventBus/blob/master/SwiftEventBus/SwiftEventBus.swift
1412
open class SwiftEventBus {
1513
enum Static {

app/src/Outlander/Infrastructure/MacroExtensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public extension NSEvent.ModifierFlags {
8181
}
8282
}
8383

84-
extension NSEvent.ModifierFlags: CustomStringConvertible {
84+
extension NSEvent.ModifierFlags: @retroactive CustomStringConvertible {
8585
public var description: String {
8686
var description = ""
8787

app/src/Outlander/Infrastructure/SimplePing.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
*/
88

99
@import Foundation;
10-
10+
1111
#include <AssertMacros.h> // for __Check_Compile_Time
12+
#include "sys/_types/_sa_family_t.h"
1213

1314
NS_ASSUME_NONNULL_BEGIN
1415

app/src/Outlander/Scripting/FunctionEvaluator.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,25 @@ class FunctionExecutor {
330330
.function("substr", arity: 3): { args in
331331
try substring(args)
332332
},
333+
// .function("percentencode", arity: 1): { args in
334+
// let text = self.trimQuotes(args[0])
335+
// if !text.isEmpty, let encoded = text.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) {
336+
// return encoded
337+
// }
338+
// return ""
339+
// },
340+
.function("element", arity: 2): { args in
341+
let index = Int(self.trimQuotes(args[0]))
342+
let list = self.trimQuotes(args[1])
343+
if let idx = index, !list.isEmpty {
344+
let items = list.components(separatedBy: "|")
345+
if idx >= 0 && idx < items.count {
346+
return items[idx]
347+
}
348+
return ""
349+
}
350+
return ""
351+
}
333352
]
334353
}
335354

0 commit comments

Comments
 (0)