Skip to content

Commit 51f1bf1

Browse files
committed
fix grammar within API
1 parent e411f6f commit 51f1bf1

File tree

8 files changed

+51
-51
lines changed

8 files changed

+51
-51
lines changed

CommandLine/CommandLine.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ extension SwiftDraw.CommandLine {
6868
static func printHelp() {
6969
print("")
7070
print("""
71-
swiftdraw, version 0.20.0
71+
swiftdraw, version 0.20.1
7272
copyright (c) 2025 Simon Whitty
7373
7474
usage: swiftdraw <file.svg> [--format png | pdf | jpeg | swift | sfsymbol] [--size wxh] [--scale 1x | 2x | 3x]

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ imageView.image = svg.rasterize()
2929
Transformations can be added before rasterizing:
3030

3131
```swift
32-
let svg = SVG(name: "fish.svg")! // 100x100
33-
.expand(left: 10, right: 10) // 120x100
34-
.scale(2) // 240x200
32+
let svg = SVG(name: "fish.svg")! // 100x100
33+
.expanded(left: 10, right: 10) // 120x100
34+
.scaled(2) // 240x200
3535

36-
imageView.image = svg.rasterize() // 240x200
36+
imageView.image = svg.rasterize() // 240x200
3737
```
3838

3939
### SwiftUI

SwiftDraw.podspec.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "SwiftDraw",
3-
"version": "0.20.0",
3+
"version": "0.20.1",
44
"summary": "A Swift library that adds support for SVG files to UIImage and NSImage.",
55
"homepage": "https://github.com/swhitty/SwiftDraw",
66
"authors": "Simon Whitty",
@@ -10,7 +10,7 @@
1010
},
1111
"source": {
1212
"git": "https://github.com/swhitty/SwiftDraw.git",
13-
"tag": "0.20.0"
13+
"tag": "0.20.1"
1414
},
1515
"platforms": {
1616
"ios": "13.0",

SwiftDraw/CommandLine+Process.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ private extension SVG {
139139

140140
func size(_ s: CGSize?) -> SVG {
141141
guard let s else { return self }
142-
return size(s)
142+
return sized(s)
143143
}
144144

145145
func inset(_ insets: Insets) -> SVG {
146-
expand(top: -insets.top, left: -insets.left, bottom: -insets.bottom, right: -insets.right)
146+
expanded(top: -insets.top, left: -insets.left, bottom: -insets.bottom, right: -insets.right)
147147
}
148148
}
149149

SwiftDraw/SVG+Deprecated.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public extension SVG {
4646

4747
@available(*, deprecated, message: "set size via SVG.size() before pngData")
4848
func pngData(size: CGSize, scale: CGFloat = 0) throws -> Data {
49-
try self.size(size).pngData(scale: scale)
49+
try self.sized(size).pngData(scale: scale)
5050
}
5151

5252
@available(*, deprecated, message: "add insets via SVG.expand() before jpegData")
@@ -56,11 +56,11 @@ public extension SVG {
5656

5757
@available(*, deprecated, message: "set size via SVG.size() before jpegData")
5858
func jpegData(size: CGSize, scale: CGFloat = 0, compressionQuality quality: CGFloat = 1) throws -> Data {
59-
try self.size(size).jpegData(scale: scale, compressionQuality: quality)
59+
try self.sized(size).jpegData(scale: scale, compressionQuality: quality)
6060
}
6161

6262
private func inset(_ insets: Insets) -> SVG {
63-
expand(top: -insets.top, left: -insets.left, bottom: -insets.bottom, right: -insets.right)
63+
expanded(top: -insets.top, left: -insets.left, bottom: -insets.bottom, right: -insets.right)
6464
}
6565

6666
#if canImport(UIKit)
@@ -80,7 +80,7 @@ public extension SVG {
8080
}
8181

8282
private func inset(_ insets: UIEdgeInsets) -> SVG {
83-
expand(top: -insets.top, left: -insets.left, bottom: -insets.bottom, right: -insets.right)
83+
expanded(top: -insets.top, left: -insets.left, bottom: -insets.bottom, right: -insets.right)
8484
}
8585
#endif
8686

SwiftDraw/SVG.swift

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public struct SVG: Hashable {
8080

8181
public extension SVG {
8282

83-
func size(_ s: CGSize) -> SVG {
83+
func sized(_ s: CGSize) -> SVG {
8484
guard size != s else { return self }
8585

8686
let sx = s.width / size.width
@@ -92,11 +92,11 @@ public extension SVG {
9292
return copy
9393
}
9494

95-
func scale(_ factor: CGFloat) -> SVG {
96-
scale(x: factor, y: factor)
95+
func scaled(_ factor: CGFloat) -> SVG {
96+
scaled(x: factor, y: factor)
9797
}
9898

99-
func scale(x: CGFloat, y: CGFloat) -> SVG {
99+
func scaled(x: CGFloat, y: CGFloat) -> SVG {
100100
var copy = self
101101

102102
copy.commands.insert(.scale(sx: x, sy: y), at: 0)
@@ -107,20 +107,20 @@ public extension SVG {
107107
return copy
108108
}
109109

110-
func translate(tx: CGFloat, ty: CGFloat) -> SVG {
110+
func translated(tx: CGFloat, ty: CGFloat) -> SVG {
111111
var copy = self
112112
copy.commands.insert(.translate(tx: tx, ty: ty), at: 0)
113113
return copy
114114
}
115115

116-
func expand(_ padding: CGFloat) -> SVG {
117-
expand(top: padding, left: padding, bottom: padding, right: padding)
116+
func expanded(_ padding: CGFloat) -> SVG {
117+
expanded(top: padding, left: padding, bottom: padding, right: padding)
118118
}
119119

120-
func expand(top: CGFloat = 0,
121-
left: CGFloat = 0,
122-
bottom: CGFloat = 0,
123-
right: CGFloat = 0) -> SVG {
120+
func expanded(top: CGFloat = 0,
121+
left: CGFloat = 0,
122+
bottom: CGFloat = 0,
123+
right: CGFloat = 0) -> SVG {
124124
var copy = self
125125
copy.commands.insert(.translate(tx: left, ty: top), at: 0)
126126
copy.size.width += left + right
@@ -212,30 +212,30 @@ public extension SVG {
212212

213213
public extension SVG {
214214

215-
mutating func sized(_ s: CGSize) {
216-
self = size(s)
215+
mutating func size(_ s: CGSize) {
216+
self = sized(s)
217217
}
218218

219-
mutating func scaled(_ factor: CGFloat) {
220-
self = scale(factor)
219+
mutating func scale(_ factor: CGFloat) {
220+
self = scaled(factor)
221221
}
222222

223-
mutating func scaled(x: CGFloat, y: CGFloat) {
224-
self = scale(x: x, y: y)
223+
mutating func scale(x: CGFloat, y: CGFloat) {
224+
self = scaled(x: x, y: y)
225225
}
226226

227-
mutating func translated(tx: CGFloat, ty: CGFloat) {
228-
self = translate(tx: tx, ty: ty)
227+
mutating func translate(tx: CGFloat, ty: CGFloat) {
228+
self = translated(tx: tx, ty: ty)
229229
}
230230

231-
mutating func expanded(_ padding: CGFloat) {
232-
self = expand(padding)
231+
mutating func expand(_ padding: CGFloat) {
232+
self = expanded(padding)
233233
}
234234

235-
mutating func expanded(top: CGFloat = 0,
236-
left: CGFloat = 0,
237-
bottom: CGFloat = 0,
238-
right: CGFloat = 0) {
239-
self = expand(top: top, left: left, bottom: bottom, right: right)
235+
mutating func expand(top: CGFloat = 0,
236+
left: CGFloat = 0,
237+
bottom: CGFloat = 0,
238+
right: CGFloat = 0) {
239+
self = expanded(top: top, left: left, bottom: bottom, right: right)
240240
}
241241
}

SwiftDraw/UIImage+SVG.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public extension SVG {
100100
#endif
101101

102102
func rasterize(size: CGSize, scale: CGFloat = 0) -> UIImage {
103-
self.size(size).rasterize(scale: scale)
103+
self.sized(size).rasterize(scale: scale)
104104
}
105105

106106
func pngData(scale: CGFloat = 0) throws -> Data {

SwiftDrawTests/SVGTests.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ final class SVGTests: XCTestCase {
7575
#if canImport(UIKit)
7676
func testRasterize() {
7777
let svg = SVG(named: "gradient-apple.svg", in: .test)!
78-
.size(CGSize(width: 100, height: 100))
78+
.sized(CGSize(width: 100, height: 100))
7979
let image = svg.rasterize(scale: 3)
8080
XCTAssertEqual(image.size, CGSize(width: 100, height: 100))
8181
XCTAssertEqual(image.scale, 3)
@@ -91,45 +91,45 @@ final class SVGTests: XCTestCase {
9191
let image = SVG.makeLines()
9292

9393
XCTAssertEqual(image.size, CGSize(width: 100, height: 100))
94-
XCTAssertEqual(image.size(CGSize(width: 200, height: 200)).size, CGSize(width: 200, height: 200))
94+
XCTAssertEqual(image.sized(CGSize(width: 200, height: 200)).size, CGSize(width: 200, height: 200))
9595

9696
var copy = image
97-
copy.sized(CGSize(width: 20, height: 20))
97+
copy.size(CGSize(width: 20, height: 20))
9898
XCTAssertEqual(copy.size, CGSize(width: 20, height: 20))
9999
}
100100

101101
func testScale() {
102102
let image = SVG.makeLines()
103103

104104
XCTAssertEqual(image.size, CGSize(width: 100, height: 100))
105-
XCTAssertEqual(image.scale(2).size, CGSize(width: 200, height: 200))
106-
XCTAssertEqual(image.scale(0.5).size, CGSize(width: 50, height: 50))
107-
XCTAssertEqual(image.scale(x: 2, y: 3).size, CGSize(width: 200, height: 300))
105+
XCTAssertEqual(image.scaled(2).size, CGSize(width: 200, height: 200))
106+
XCTAssertEqual(image.scaled(0.5).size, CGSize(width: 50, height: 50))
107+
XCTAssertEqual(image.scaled(x: 2, y: 3).size, CGSize(width: 200, height: 300))
108108

109109
var copy = image
110-
copy.scaled(5)
110+
copy.scale(5)
111111
XCTAssertEqual(copy.size, CGSize(width: 500, height: 500))
112112
}
113113

114114
func testTranslate() {
115115
let image = SVG.makeLines()
116116

117117
XCTAssertEqual(image.size, CGSize(width: 100, height: 100))
118-
XCTAssertEqual(image.translate(tx: 10, ty: 10).size, CGSize(width: 100, height: 100))
118+
XCTAssertEqual(image.translated(tx: 10, ty: 10).size, CGSize(width: 100, height: 100))
119119

120120
var copy = image
121-
copy.translated(tx: 50, ty: 50)
121+
copy.translate(tx: 50, ty: 50)
122122
XCTAssertEqual(copy.size, CGSize(width: 100, height: 100))
123123
}
124124

125125
func testExpand() {
126126
let image = SVG.makeLines()
127127

128128
XCTAssertEqual(image.size, CGSize(width: 100, height: 100))
129-
XCTAssertEqual(image.expand(top: 50, right: 30).size, CGSize(width: 130, height: 150))
129+
XCTAssertEqual(image.expanded(top: 50, right: 30).size, CGSize(width: 130, height: 150))
130130

131131
var copy = image
132-
copy.expanded(-10)
132+
copy.expand(-10)
133133
XCTAssertEqual(copy.size, CGSize(width: 80, height: 80))
134134
}
135135
}

0 commit comments

Comments
 (0)