Skip to content

Commit 670e05f

Browse files
committed
Update SVGPath to 1.2.0
1 parent e504236 commit 670e05f

12 files changed

Lines changed: 148 additions & 69 deletions

File tree

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let package = Package(
2323
),
2424
.package(
2525
url: "https://github.com/nicklockwood/SVGPath.git",
26-
.upToNextMinor(from: "1.1.6")
26+
.upToNextMinor(from: "1.2.0")
2727
),
2828
],
2929
targets: [
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: build
2+
3+
on:
4+
push:
5+
pull_request:
6+
jobs:
7+
macos:
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
macos:
12+
- 14
13+
xcode:
14+
- latest-stable
15+
runs-on: macos-${{ matrix.macos }}
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
- name: Build and Test
20+
run: |
21+
xcodebuild -scheme "SVGPath" -sdk macosx clean build test -enableCodeCoverage YES -derivedDataPath Build/
22+
cd Build/Build/ProfileData
23+
cd $(ls -d */|head -n 1)
24+
directory=${PWD##*/}
25+
pathCoverage=Build/Build/ProfileData/${directory}/Coverage.profdata
26+
cd ../../../../
27+
xcrun llvm-cov export -format="lcov" -instr-profile $pathCoverage Build/Build/Products/Debug/SVGPath.framework/SVGPath > info.lcov
28+
- name: Codecov
29+
uses: codecov/codecov-action@v2
30+
with:
31+
# the token is optional for a public repo, but including it anyway
32+
token: 274eb389-3ca6-48d4-82c3-424a10cf611c
33+
env_vars: MD_APPLE_SDK_ROOT,RUNNER_OS,RUNNER_ARCH
34+
35+
linux:
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
swiftver:
40+
- swift:5.7
41+
- swiftlang/swift:nightly-main
42+
swiftos:
43+
- focal
44+
runs-on: ubuntu-latest
45+
container:
46+
image: ${{ format('{0}-{1}', matrix.swiftver, matrix.swiftos) }}
47+
options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --security-opt apparmor=unconfined
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v1
51+
- name: Build and Test
52+
run: swift test --enable-test-discovery
53+
54+
swiftwasm_test_5_9:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v3
58+
- uses: swiftwasm/[email protected]
59+
with:
60+
shell-action: carton test
61+

SVGPath/.swift-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

SVGPath/.swiftformat

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1+
# file options
2+
3+
--exclude Package.swift
4+
5+
# format options
6+
7+
--swiftversion 5.7
18
--hexgrouping ignore
29
--decimalgrouping ignore
3-
--enable isEmpty
410
--ifdef no-indent
511
--self init-only
612
--wraparguments before-first
713
--wrapcollections before-first
8-
--maxwidth 80
14+
--maxwidth 100
15+
16+
# rules
917

10-
--exclude Package.swift
18+
--enable isEmpty
19+
--enable noGuardInTests
20+
--enable throwingTests
21+
--enable redundantEquatable
22+
--enable redundantMemberwiseInit
23+
--enable redundantProperty

SVGPath/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [1.2.0](https://github.com/nicklockwood/SVGPath/releases/tag/1.2.0) (2025-08-01)
2+
3+
- Added Sendable conformance for all `SVGPath` types
4+
- Bumped required Swift version to 5.7
5+
16
## [1.1.6](https://github.com/nicklockwood/SVGPath/releases/tag/1.1.6) (2025-04-06)
27

38
- Fixed stack overflow for large paths in debug builds

SVGPath/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.1
1+
// swift-tools-version:5.7
22
import PackageDescription
33

44
let package = Package(

SVGPath/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![Build](https://github.com/nicklockwood/SVGPath/actions/workflows/build.yml/badge.svg)](https://github.com/nicklockwood/SVGPath/actions/workflows/build.yml)
22
[![Codecov](https://codecov.io/gh/nicklockwood/SVGPath/graphs/badge.svg)](https://codecov.io/gh/nicklockwood/SVGPath)
33
[![Platforms](https://img.shields.io/badge/platforms-iOS%20|%20Mac%20|%20tvOS%20|%20Linux-lightgray.svg)]()
4-
[![Swift 5.1](https://img.shields.io/badge/swift-5.1-red.svg?style=flat)](https://developer.apple.com/swift)
4+
[![Swift 5.7](https://img.shields.io/badge/swift-5.7-red.svg?style=flat)](https://developer.apple.com/swift)
55
[![License](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://opensource.org/licenses/MIT)
66
[![Mastodon](https://img.shields.io/badge/mastodon-@[email protected])](https://mastodon.social/@nicklockwood)
77

@@ -23,12 +23,12 @@ SVGPath runs on all Apple platforms, and also Linux (although Linux does not sup
2323

2424
SVGPath is packaged as a dynamic framework that you can import into your Xcode project. You can install this manually, or by using Swift Package Manager.
2525

26-
**Note:** SVGPath requires Xcode 10+ to build, and runs on iOS 10+ or macOS 10.12+.
26+
**Note:** SVGPath requires Xcode 14+ to build, and runs on iOS 12+ or macOS 10.14+.
2727

2828
To install using Swift Package Manage, add this to the `dependencies:` section in your Package.swift file:
2929

3030
```swift
31-
.package(url: "https://github.com/nicklockwood/SVGPath.git", .upToNextMinor(from: "1.0.0")),
31+
.package(url: "https://github.com/nicklockwood/SVGPath.git", .upToNextMinor(from: "1.1.0")),
3232
```
3333

3434

SVGPath/SVGPath.xcodeproj/project.pbxproj

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,11 @@
107107
};
108108
/* End PBXGroup section */
109109

110-
/* Begin PBXHeadersBuildPhase section */
111-
016FAB2421BFE78100AF60DC /* Headers */ = {
112-
isa = PBXHeadersBuildPhase;
113-
buildActionMask = 2147483647;
114-
files = (
115-
);
116-
runOnlyForDeploymentPostprocessing = 0;
117-
};
118-
/* End PBXHeadersBuildPhase section */
119-
120110
/* Begin PBXNativeTarget section */
121111
016FAB2821BFE78100AF60DC /* SVGPath */ = {
122112
isa = PBXNativeTarget;
123113
buildConfigurationList = 016FAB3D21BFE78100AF60DC /* Build configuration list for PBXNativeTarget "SVGPath" */;
124114
buildPhases = (
125-
016FAB2421BFE78100AF60DC /* Headers */,
126115
016FAB2521BFE78100AF60DC /* Sources */,
127116
0A24014C256AA09600C1535C /* Lint Code */,
128117
016FAB2621BFE78100AF60DC /* Frameworks */,
@@ -325,6 +314,7 @@
325314
DEBUG_INFORMATION_FORMAT = dwarf;
326315
ENABLE_STRICT_OBJC_MSGSEND = YES;
327316
ENABLE_TESTABILITY = YES;
317+
ENABLE_USER_SCRIPT_SANDBOXING = NO;
328318
GCC_C_LANGUAGE_STANDARD = gnu11;
329319
GCC_DYNAMIC_NO_PIC = NO;
330320
GCC_NO_COMMON_BLOCKS = YES;
@@ -339,16 +329,17 @@
339329
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
340330
GCC_WARN_UNUSED_FUNCTION = YES;
341331
GCC_WARN_UNUSED_VARIABLE = YES;
342-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
332+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
343333
MACOSX_DEPLOYMENT_TARGET = 10.13;
344334
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
345335
MTL_FAST_MATH = YES;
346336
ONLY_ACTIVE_ARCH = YES;
347337
SDKROOT = macosx;
348338
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
349339
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
350-
SWIFT_VERSION = 4.2;
351-
TVOS_DEPLOYMENT_TARGET = 11.0;
340+
SWIFT_STRICT_CONCURRENCY = complete;
341+
SWIFT_VERSION = 5.0;
342+
TVOS_DEPLOYMENT_TARGET = 12.0;
352343
VERSIONING_SYSTEM = "apple-generic";
353344
VERSION_INFO_PREFIX = "";
354345
WATCHOS_DEPLOYMENT_TARGET = 8.7;
@@ -396,6 +387,7 @@
396387
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
397388
ENABLE_NS_ASSERTIONS = NO;
398389
ENABLE_STRICT_OBJC_MSGSEND = YES;
390+
ENABLE_USER_SCRIPT_SANDBOXING = NO;
399391
GCC_C_LANGUAGE_STANDARD = gnu11;
400392
GCC_NO_COMMON_BLOCKS = YES;
401393
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -404,15 +396,16 @@
404396
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
405397
GCC_WARN_UNUSED_FUNCTION = YES;
406398
GCC_WARN_UNUSED_VARIABLE = YES;
407-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
399+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
408400
MACOSX_DEPLOYMENT_TARGET = 10.13;
409401
MTL_ENABLE_DEBUG_INFO = NO;
410402
MTL_FAST_MATH = YES;
411403
SDKROOT = macosx;
412404
SWIFT_COMPILATION_MODE = wholemodule;
413405
SWIFT_OPTIMIZATION_LEVEL = "-O";
414-
SWIFT_VERSION = 4.2;
415-
TVOS_DEPLOYMENT_TARGET = 11.0;
406+
SWIFT_STRICT_CONCURRENCY = complete;
407+
SWIFT_VERSION = 5.0;
408+
TVOS_DEPLOYMENT_TARGET = 12.0;
416409
VERSIONING_SYSTEM = "apple-generic";
417410
VERSION_INFO_PREFIX = "";
418411
WATCHOS_DEPLOYMENT_TARGET = 8.7;
@@ -429,7 +422,7 @@
429422
COMBINE_HIDPI_IMAGES = YES;
430423
DEAD_CODE_STRIPPING = YES;
431424
DEFINES_MODULE = YES;
432-
DEVELOPMENT_TEAM = 8VQKF583ED;
425+
DEVELOPMENT_TEAM = "";
433426
DYLIB_COMPATIBILITY_VERSION = 1;
434427
DYLIB_CURRENT_VERSION = 1;
435428
DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -442,20 +435,18 @@
442435
"@executable_path/../Frameworks",
443436
"@loader_path/Frameworks",
444437
);
445-
MARKETING_VERSION = 1.1.6;
438+
MARKETING_VERSION = 1.2.0;
446439
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14";
447440
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=75";
448441
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.SVGPath;
449442
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";
450443
PRODUCT_NAME = SVGPath;
451444
SDKROOT = "";
452445
SKIP_INSTALL = YES;
453-
SUPPORTED_PLATFORMS = "$(AVAILABLE_PLATFORMS)";
446+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator";
454447
SUPPORTS_MACCATALYST = YES;
455448
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
456-
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;
457449
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
458-
SWIFT_VERSION = 5.0;
459450
};
460451
name = Debug;
461452
};
@@ -468,7 +459,7 @@
468459
COMBINE_HIDPI_IMAGES = YES;
469460
DEAD_CODE_STRIPPING = YES;
470461
DEFINES_MODULE = YES;
471-
DEVELOPMENT_TEAM = 8VQKF583ED;
462+
DEVELOPMENT_TEAM = "";
472463
DYLIB_COMPATIBILITY_VERSION = 1;
473464
DYLIB_CURRENT_VERSION = 1;
474465
DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -481,19 +472,17 @@
481472
"@executable_path/../Frameworks",
482473
"@loader_path/Frameworks",
483474
);
484-
MARKETING_VERSION = 1.1.6;
475+
MARKETING_VERSION = 1.2.0;
485476
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14";
486477
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=75";
487478
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.SVGPath;
488479
PRODUCT_MODULE_NAME = "$(PRODUCT_NAME:c99extidentifier)";
489480
PRODUCT_NAME = SVGPath;
490481
SDKROOT = "";
491482
SKIP_INSTALL = YES;
492-
SUPPORTED_PLATFORMS = "$(AVAILABLE_PLATFORMS)";
483+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator";
493484
SUPPORTS_MACCATALYST = YES;
494485
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
495-
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = YES;
496-
SWIFT_VERSION = 5.0;
497486
};
498487
name = Release;
499488
};
@@ -515,7 +504,6 @@
515504
PRODUCT_NAME = "$(TARGET_NAME)";
516505
PROVISIONING_PROFILE_SPECIFIER = "";
517506
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator";
518-
SWIFT_VERSION = 5.0;
519507
};
520508
name = Debug;
521509
};
@@ -537,7 +525,6 @@
537525
PRODUCT_NAME = "$(TARGET_NAME)";
538526
PROVISIONING_PROFILE_SPECIFIER = "";
539527
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator";
540-
SWIFT_VERSION = 5.0;
541528
};
542529
name = Release;
543530
};

SVGPath/Sources/SVGPath.swift

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
import Foundation
3333

34-
public struct SVGPath: Hashable {
34+
public struct SVGPath: Hashable, Sendable {
3535
public var commands: [SVGCommand]
3636

3737
public init(commands: [SVGCommand]) {
@@ -47,11 +47,9 @@ public struct SVGPath: Hashable {
4747

4848
func assertArgs(_ count: Int) throws -> [Double] {
4949
if numbers.count < count {
50-
throw SVGError
51-
.missingArgument(for: String(token), expected: count)
50+
throw SVGError.missingArgument(for: String(token), expected: count)
5251
} else if !numbers.count.isMultiple(of: count) {
53-
throw SVGError
54-
.unexpectedArgument(for: String(token), expected: count)
52+
throw SVGError.unexpectedArgument(for: String(token), expected: count)
5553
}
5654
defer { numbers.removeFirst(count) }
5755
return Array(numbers.prefix(count))
@@ -180,9 +178,7 @@ public struct SVGPath: Hashable {
180178
case " ": return
181179
default: throw SVGError.unexpectedToken(String(token))
182180
}
183-
commands.append(
184-
isRelative ? command.relative(to: commands) : command
185-
)
181+
commands.append(isRelative ? command.relative(to: commands) : command)
186182
} while !numbers.isEmpty
187183
}
188184

@@ -230,7 +226,7 @@ public extension SVGPath {
230226
return points
231227
}
232228

233-
struct WriteOptions {
229+
struct WriteOptions: Sendable {
234230
public static let `default` = Self()
235231

236232
public var prettyPrinted: Bool
@@ -300,7 +296,7 @@ private extension Character {
300296
}
301297
}
302298

303-
private extension Array where Element == SVGCommand {
299+
private extension [SVGCommand] {
304300
var lastPoint: SVGPoint {
305301
for command in reversed() {
306302
if let point = command.point {
@@ -335,7 +331,7 @@ public enum SVGError: Error, Hashable {
335331
}
336332
}
337333

338-
public enum SVGCommand: Hashable {
334+
public enum SVGCommand: Hashable, Sendable {
339335
case moveTo(SVGPoint)
340336
case lineTo(SVGPoint)
341337
case cubic(SVGPoint, SVGPoint, SVGPoint)
@@ -401,7 +397,7 @@ public extension SVGCommand {
401397
func endSubpath() {
402398
if start == points.count - 1 {
403399
points.removeLast()
404-
} else if let start = start {
400+
} else if let start {
405401
points.append(points[start])
406402
}
407403
}
@@ -469,7 +465,7 @@ public extension SVGCommand {
469465
}
470466
}
471467

472-
public struct SVGPoint: Hashable {
468+
public struct SVGPoint: Hashable, Sendable {
473469
public var x, y: Double
474470

475471
public init(x: Double, y: Double) {
@@ -498,7 +494,7 @@ public extension SVGPoint {
498494
}
499495
}
500496

501-
public struct SVGArc: Hashable {
497+
public struct SVGArc: Hashable, Sendable {
502498
public var radius: SVGPoint
503499
public var rotation: Double
504500
public var largeArc: Bool

SVGPath/Tests/CGPathTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ class CGPathTests: XCTestCase {
108108
}
109109

110110
func testCross() throws {
111-
let svgPath =
112-
try SVGPath(string: "M2 1 h1 v1 h1 v1 h-1 v1 h-1 v-1 h-1 v-1 h1 z")
111+
let svgPath = try SVGPath(string: "M2 1 h1 v1 h1 v1 h-1 v1 h-1 v-1 h-1 v-1 h1 z")
113112
let cgPath = CGMutablePath()
114113
cgPath.move(to: CGPoint(x: 2, y: -1))
115114
cgPath.addLine(to: CGPoint(x: 3, y: -1))

0 commit comments

Comments
 (0)