Skip to content

Commit 24060d3

Browse files
authored
Merge pull request #78 from swhitty/swift-6
Swift 6 Language Mode
2 parents 07ecf45 + 54dbba2 commit 24060d3

35 files changed

+176
-82
lines changed

Package.swift

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.8
1+
// swift-tools-version:6.0
22

33
import PackageDescription
44

@@ -19,20 +19,33 @@ let package = Package(
1919
.target(
2020
name: "SwiftDraw",
2121
dependencies: [],
22-
path: "SwiftDraw"
22+
path: "SwiftDraw",
23+
swiftSettings: .upcomingFeatures
2324
),
2425
.executableTarget(
2526
name: "CommandLine",
2627
dependencies: ["SwiftDraw"],
27-
path: "CommandLine"
28+
path: "CommandLine",
29+
swiftSettings: .upcomingFeatures
2830
),
2931
.testTarget(
3032
name: "SwiftDrawTests",
3133
dependencies: ["SwiftDraw"],
3234
path: "SwiftDrawTests",
3335
resources: [
3436
.copy("Test.bundle")
35-
]
37+
],
38+
swiftSettings: .upcomingFeatures
3639
)
3740
]
3841
)
42+
43+
extension Array where Element == SwiftSetting {
44+
45+
static var upcomingFeatures: [SwiftSetting] {
46+
[
47+
.enableUpcomingFeature("ExistentialAny"),
48+
.swiftLanguageMode(.v6)
49+
]
50+
}
51+
}

[email protected]

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// swift-tools-version:5.8
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "SwiftDraw",
7+
platforms: [
8+
.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6)
9+
],
10+
products: [
11+
// Products define the executables and libraries produced by a package, and make them visible to other packages.
12+
.executable(name: "swiftdrawcli", targets: ["CommandLine"]),
13+
.library(
14+
name: "SwiftDraw",
15+
targets: ["SwiftDraw"]),
16+
],
17+
dependencies: [],
18+
targets: [
19+
.target(
20+
name: "SwiftDraw",
21+
dependencies: [],
22+
path: "SwiftDraw"
23+
),
24+
.executableTarget(
25+
name: "CommandLine",
26+
dependencies: ["SwiftDraw"],
27+
path: "CommandLine"
28+
),
29+
.testTarget(
30+
name: "SwiftDrawTests",
31+
dependencies: ["SwiftDraw"],
32+
path: "SwiftDrawTests",
33+
resources: [
34+
.copy("Test.bundle")
35+
]
36+
)
37+
]
38+
)

[email protected]

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// swift-tools-version:5.9
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "SwiftDraw",
7+
platforms: [
8+
.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6)
9+
],
10+
products: [
11+
// Products define the executables and libraries produced by a package, and make them visible to other packages.
12+
.executable(name: "swiftdrawcli", targets: ["CommandLine"]),
13+
.library(
14+
name: "SwiftDraw",
15+
targets: ["SwiftDraw"]),
16+
],
17+
dependencies: [],
18+
targets: [
19+
.target(
20+
name: "SwiftDraw",
21+
dependencies: [],
22+
path: "SwiftDraw"
23+
),
24+
.executableTarget(
25+
name: "CommandLine",
26+
dependencies: ["SwiftDraw"],
27+
path: "CommandLine"
28+
),
29+
.testTarget(
30+
name: "SwiftDrawTests",
31+
dependencies: ["SwiftDraw"],
32+
path: "SwiftDrawTests",
33+
resources: [
34+
.copy("Test.bundle")
35+
]
36+
)
37+
]
38+
)

SwiftDraw/CommandLine.Configuration.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ private extension XMLParser.Scanner {
248248
}
249249

250250
extension SVG.Options {
251-
static let disableTransparencyLayers = Self(rawValue: 1 << 8)
252-
static let commandLine = Self(rawValue: 1 << 9)
251+
static var disableTransparencyLayers: SVG.Options { Self(rawValue: 1 << 8) }
252+
static var commandLine: SVG.Options { Self(rawValue: 1 << 9) }
253253
}
254254

255255
extension URL {

SwiftDraw/DOM.Element.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ extension DOM {
4444

4545
class Element {}
4646

47-
class GraphicsElement: Element, ElementAttributes {
47+
class GraphicsElement: Element, ElementAttributes, @unchecked Sendable {
4848
var id: String?
4949
var `class`: String?
5050

5151
var attributes = PresentationAttributes()
5252
var style = PresentationAttributes()
5353
}
5454

55-
final class Line: GraphicsElement {
55+
final class Line: GraphicsElement, @unchecked Sendable {
5656
var x1: Coordinate
5757
var y1: Coordinate
5858
var x2: Coordinate
@@ -67,7 +67,7 @@ extension DOM {
6767
}
6868
}
6969

70-
final class Circle: GraphicsElement {
70+
final class Circle: GraphicsElement, @unchecked Sendable {
7171
var cx: Coordinate?
7272
var cy: Coordinate?
7373
var r: Coordinate
@@ -80,7 +80,7 @@ extension DOM {
8080
}
8181
}
8282

83-
final class Ellipse: GraphicsElement {
83+
final class Ellipse: GraphicsElement, @unchecked Sendable {
8484
var cx: Coordinate?
8585
var cy: Coordinate?
8686
var rx: Coordinate
@@ -95,7 +95,7 @@ extension DOM {
9595
}
9696
}
9797

98-
final class Rect: GraphicsElement {
98+
final class Rect: GraphicsElement, @unchecked Sendable {
9999
var x: Coordinate?
100100
var y: Coordinate?
101101
var width: Coordinate
@@ -113,7 +113,7 @@ extension DOM {
113113
}
114114
}
115115

116-
final class Polyline: GraphicsElement {
116+
final class Polyline: GraphicsElement, @unchecked Sendable {
117117
var points: [Point]
118118

119119
init(points: [Point]) {
@@ -122,7 +122,7 @@ extension DOM {
122122
}
123123
}
124124

125-
final class Polygon: GraphicsElement {
125+
final class Polygon: GraphicsElement, @unchecked Sendable {
126126
var points: [Point]
127127

128128
init(points: [Point]) {
@@ -131,7 +131,7 @@ extension DOM {
131131
}
132132
}
133133

134-
final class Group: GraphicsElement, ContainerElement {
134+
final class Group: GraphicsElement, ContainerElement, @unchecked Sendable {
135135
var childElements = [GraphicsElement]()
136136
}
137137
}

SwiftDraw/DOM.Image.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
// 3. This notice may not be removed or altered from any source distribution.
3030
//
3131
extension DOM {
32-
final class Image: GraphicsElement {
32+
final class Image: GraphicsElement, @unchecked Sendable {
3333
var href: URL
3434
var width: Coordinate?
3535
var height: Coordinate?

SwiftDraw/DOM.Path.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import Foundation
3333

3434
extension DOM {
3535

36-
final class Path: GraphicsElement {
36+
final class Path: GraphicsElement, @unchecked Sendable {
3737

3838
// segments[0] should always be a .move
3939
var segments: [Segment]

SwiftDraw/DOM.SVG.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//
3131

3232
extension DOM {
33-
final class SVG: GraphicsElement, ContainerElement {
33+
final class SVG: GraphicsElement, ContainerElement, @unchecked Sendable {
3434
var x: Coordinate?
3535
var y: Coordinate?
3636
var width: Length

SwiftDraw/DOM.Switch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//
3131

3232
extension DOM {
33-
final class Switch: GraphicsElement, ContainerElement {
33+
final class Switch: GraphicsElement, ContainerElement, @unchecked Sendable {
3434
var childElements = [DOM.GraphicsElement]()
3535
}
3636
}

SwiftDraw/DOM.Text.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import Foundation
3333

3434
extension DOM {
3535

36-
final class Text: GraphicsElement {
36+
final class Text: GraphicsElement, @unchecked Sendable {
3737
var x: Coordinate?
3838
var y: Coordinate?
3939
var value: String
@@ -45,7 +45,7 @@ extension DOM {
4545
}
4646
}
4747

48-
final class Anchor: GraphicsElement, ContainerElement {
48+
final class Anchor: GraphicsElement, ContainerElement, @unchecked Sendable {
4949
var href: URL?
5050
var childElements = [GraphicsElement]()
5151
}

0 commit comments

Comments
 (0)