Skip to content

Commit 359951c

Browse files
committed
Update to Swift 6
1 parent 8b4189a commit 359951c

19 files changed

Lines changed: 49 additions & 34 deletions

Example/PredicateViewExample.xcodeproj/project.pbxproj

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
4A7236902CA8A677003DD1EC /* CustomExpressionDemoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A72368F2CA8A677003DD1EC /* CustomExpressionDemoView.swift */; };
1111
4A7236922CA8A877003DD1EC /* PredicateDecodingDemoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A7236912CA8A877003DD1EC /* PredicateDecodingDemoView.swift */; };
1212
4A7236942CA8A9B3003DD1EC /* ReadOnlyDemoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A7236932CA8A9B3003DD1EC /* ReadOnlyDemoView.swift */; };
13+
4A7D7B472D0E8B5D0027A305 /* PredicateView in Frameworks */ = {isa = PBXBuildFile; productRef = 4A7D7B462D0E8B5D0027A305 /* PredicateView */; };
1314
4ACACCED2C9F5C65003FA734 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ACACCE82C9F5C65003FA734 /* ContentView.swift */; };
1415
4ACACCEE2C9F5C65003FA734 /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ACACCE92C9F5C65003FA734 /* Item.swift */; };
1516
4ACACCEF2C9F5C65003FA734 /* PredicateViewExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ACACCEB2C9F5C65003FA734 /* PredicateViewExampleApp.swift */; };
@@ -42,6 +43,7 @@
4243
buildActionMask = 2147483647;
4344
files = (
4445
4ACACCFE2C9F5E26003FA734 /* PredicateView in Frameworks */,
46+
4A7D7B472D0E8B5D0027A305 /* PredicateView in Frameworks */,
4547
4ACACCF72C9F5C9B003FA734 /* PredicateView in Frameworks */,
4648
);
4749
runOnlyForDeploymentPostprocessing = 0;
@@ -110,6 +112,7 @@
110112
packageProductDependencies = (
111113
4ACACCF32C9F5C78003FA734 /* PredicateView */,
112114
4ACACCF62C9F5C9B003FA734 /* PredicateView */,
115+
4A7D7B462D0E8B5D0027A305 /* PredicateView */,
113116
);
114117
productName = PredicateViewExample;
115118
productReference = 4ACACCD12C9F5C56003FA734 /* PredicateViewExample.app */;
@@ -140,7 +143,7 @@
140143
mainGroup = 4ACACCC82C9F5C56003FA734;
141144
minimizedProjectReferenceProxies = 1;
142145
packageReferences = (
143-
4ACACCF52C9F5C9B003FA734 /* XCLocalSwiftPackageReference "../../PredicateView" */,
146+
4A7D7B452D0E8B5D0027A305 /* XCLocalSwiftPackageReference "../../PredicateView" */,
144147
);
145148
preferredProjectObjectVersion = 77;
146149
productRefGroup = 4ACACCD22C9F5C56003FA734 /* Products */;
@@ -395,13 +398,17 @@
395398
/* End XCConfigurationList section */
396399

397400
/* Begin XCLocalSwiftPackageReference section */
398-
4ACACCF52C9F5C9B003FA734 /* XCLocalSwiftPackageReference "../../PredicateView" */ = {
401+
4A7D7B452D0E8B5D0027A305 /* XCLocalSwiftPackageReference "../../PredicateView" */ = {
399402
isa = XCLocalSwiftPackageReference;
400403
relativePath = ../../PredicateView;
401404
};
402405
/* End XCLocalSwiftPackageReference section */
403406

404407
/* Begin XCSwiftPackageProductDependency section */
408+
4A7D7B462D0E8B5D0027A305 /* PredicateView */ = {
409+
isa = XCSwiftPackageProductDependency;
410+
productName = PredicateView;
411+
};
405412
4ACACCF32C9F5C78003FA734 /* PredicateView */ = {
406413
isa = XCSwiftPackageProductDependency;
407414
productName = PredicateView;

Package.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 5.10
1+
// swift-tools-version: 6.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
@@ -19,8 +19,11 @@ let package = Package(
1919
.package(url: "https://github.com/NoahKamara/CompoundPredicate", from: "0.1.0"),
2020
],
2121
targets: [
22-
.target(name: "PredicateView", dependencies: [
23-
.product(name: "CompoundPredicate", package: "CompoundPredicate"),
24-
]),
22+
.target(
23+
name: "PredicateView",
24+
dependencies: [
25+
.product(name: "CompoundPredicate", package: "CompoundPredicate"),
26+
]
27+
),
2528
]
2629
)

Sources/PredicateView/Attributes/ExpressionAttribute.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public struct StandardAttribute<Expr>: ExpressionAttribute where Expr: Predicate
1717
public var value: Expr.AttributeValue
1818
}
1919

20-
public struct MetadataAttribute<Expr, Metadata>: ExpressionAttribute where Expr: PredicateExpressionConvertible {
20+
public struct MetadataAttribute<Expr, Metadata>: ExpressionAttribute where Expr: PredicateExpressionConvertible, Metadata: Sendable {
2121
public var `operator`: Expr.Operator
2222
public var value: Expr.AttributeValue
2323
public var metadata: Metadata

Sources/PredicateView/Attributes/OperatorContainer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
public protocol OperatorContainer: Equatable {
10+
public protocol OperatorContainer: Equatable, Sendable {
1111
associatedtype Expr: ExpressionProtocol
1212
var `operator`: Expr.Operator { get set }
1313
}

Sources/PredicateView/Expressions/Abstract/AnyExpression.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
import Foundation
99

10-
public typealias ExpressionCompatible = Codable & Hashable
10+
public typealias ExpressionCompatible = Codable & Hashable & Sendable
1111

1212
/// A generic struct that wraps any type conforming to the ``TitledExpression`` protocol.
1313
/// It provides type erasure for expressions, allowing different types of expressions
1414
/// to be used interchangeably as long as they share the same ``Root`` type.
15-
public struct AnyExpression<Root>: Identifiable {
15+
public struct AnyExpression<Root>: Identifiable, Sendable {
1616
/// The underlying expression that conforms to the ``TitledExpression`` protocol.
1717
public var wrappedValue: any TitledExpression<Root>
1818

Sources/PredicateView/Expressions/Abstract/ContentExpression.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public protocol ContentExpression<Root>: PredicateExpressionConvertible & Titled
1313
associatedtype ExprView = ContentExpressionView<Root, Self>
1414
associatedtype Result: View
1515

16-
@ViewBuilder
16+
@ViewBuilder @MainActor
1717
static func makeContentView(_ value: Binding<AttributeValue>) -> Result
1818
}
1919

@@ -25,7 +25,7 @@ public struct ContentExpressionView<Root, Expr: ContentExpression<Root>>: Expres
2525
self.expression = expression
2626
}
2727

28-
@ViewBuilder
28+
@MainActor
2929
public var body: some View {
3030
@Binding(projectedValue: self.expression) var expression: Expr
3131

Sources/PredicateView/Expressions/Abstract/ExpressionProtocol+ViewFactory.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import SwiftUI
99

1010
extension ExpressionProtocol {
11-
@ViewBuilder
11+
@ViewBuilder @MainActor
1212
public static func makeOperatorMenu<T: Hashable>(
1313
using operation: Binding<T>
1414
) -> some View {
@@ -18,7 +18,7 @@ extension ExpressionProtocol {
1818
}
1919
}
2020

21-
@ViewBuilder
21+
@ViewBuilder @MainActor
2222
public static func makeOperatorMenu<T: Hashable>(
2323
using operation: Binding<T>,
2424
@ViewBuilder itemProvider: @escaping (Operator) -> some View
@@ -33,10 +33,12 @@ extension ExpressionProtocol {
3333
.labelsHidden()
3434
}
3535

36+
@MainActor
3637
public static func makeView(for expression: Binding<Self>) -> some ExpressionView {
3738
makeView(for: expression, parent: nil)
3839
}
3940

41+
@MainActor
4042
public static func makeView(for expression: Binding<Self>, parent: Binding<LogicalExpression<Root>>?) -> some ExpressionView {
4143
ExprView(expression: expression, parent: parent)
4244
}

Sources/PredicateView/Expressions/Abstract/ExpressionProtocol.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
// MARK: - Expression
1111

1212
/// Defines the core requirements for an expression in the predicate builder system.
13-
public protocol ExpressionProtocol<Root>: Identifiable {
13+
public protocol ExpressionProtocol<Root>: Identifiable, Sendable {
1414
/// The root type that this expression operates on.
1515
associatedtype Root
1616

@@ -36,4 +36,4 @@ public protocol ExpressionProtocol<Root>: Identifiable {
3636
) -> (any StandardPredicateExpression<Bool>)?
3737
}
3838

39-
public protocol ExpressionOperator: CaseIterable, Hashable, RawRepresentable where RawValue == String, AllCases: RandomAccessCollection, AllCases.Index == Int { }
39+
public protocol ExpressionOperator: CaseIterable, Hashable, RawRepresentable, Sendable where RawValue == String, AllCases: RandomAccessCollection, AllCases.Index == Int { }

Sources/PredicateView/Expressions/Abstract/KeyPathExpression.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ extension KeyPathExpression {
2222
typealias KeyPathPredicateExpression = PredicateExpressions.KeyPath<PredicateExpressions.Variable<Root>, Value>
2323
typealias ValuePredicateExpression = PredicateExpressions.Value<Value>
2424
}
25+
26+
extension KeyPath: @retroactive @unchecked Sendable { }

Sources/PredicateView/Expressions/Abstract/PredicateExpressionConvertible.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public protocol PredicateExpressionConvertible<Root>: LeafPredicateExpressionDec
1414
associatedtype Attribute: ExpressionAttribute<Self>
1515

1616
/// The type of the value associated with the attribute.
17-
associatedtype AttributeValue: Hashable
17+
associatedtype AttributeValue: Hashable & Sendable
1818

1919
/// The default attribute for this expression type.
2020
static var defaultAttribute: Attribute { get }

0 commit comments

Comments
 (0)