Skip to content

Commit 418b164

Browse files
authored
Merge pull request #29 from temoki/develop
Added canvas color feature
2 parents 4e019bd + 4cdc851 commit 418b164

21 files changed

Lines changed: 69 additions & 24 deletions

File tree

InstallationTests/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@ open Cocoapods-macOS.xcworkspace
3131

3232
```shell
3333
cd ./SwiftPM
34+
swift package update
3435
swift build
3536
```

InstallationTests/SwiftPM/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
/Packages
44
/*.xcodeproj
55
Package.pins
6-
output.png
6+
Package.resolved
7+
output.png
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
// swift-tools-version:3.1
1+
// swift-tools-version:4.0.0
22

33
import PackageDescription
44

55
let package = Package(
66
name: "SwiftPM",
77
dependencies: [
8-
.Package(url: "https://github.com/temoki/TortoiseGraphics.git", majorVersion: 0)
8+
.package(url: "https://github.com/temoki/TortoiseGraphics.git", .branch("develop")),
9+
],
10+
targets: [
11+
.target(name: "SwiftPM", dependencies: ["TortoiseGraphics"], path: "Sources"),
912
]
1013
)
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import Foundation
22
import TortoiseGraphics
3-
let 🐢 = Tortoise()
4-
🐢.fd(100)
5-
🐢.writePNG(of: CGSize(width: 300, height: 300), to: URL(fileURLWithPath: "./output.png"))
3+
4+
let canvas = ImageCanvas(size: CGSize(width: 300, height: 300))
5+
canvas.color = .white
6+
canvas.drawing { 🐢 in
7+
🐢.right(90)
8+
🐢.forward(100)
9+
}
10+
canvas.writePNG(to: URL(fileURLWithPath: "./output.png"))

OutputExamples/example1.gif

709 KB
Loading

OutputExamples/example1.png

-4.35 KB
Loading

OutputExamples/example2.gif

1.63 MB
Loading

OutputExamples/example2.png

100 Bytes
Loading

Playground/Playground.playground/Pages/With 2 tortoises.xcplaygroundpage/Contents.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import CoreGraphics
66

77
let canvas = PlaygroundCanvas(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
88
canvas.frameRate = 30
9+
canvas.color = .white
910
PlaygroundPage.current.liveView = canvas
1011

1112
canvas.drawingWithTortoises(count: 2) { tortoises in

Playground/Playground.playground/Pages/With a tortoise.xcplaygroundpage/Contents.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import CoreGraphics
66

77
let canvas = PlaygroundCanvas(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
88
canvas.frameRate = 30
9+
canvas.color = .white
910
PlaygroundPage.current.liveView = canvas
1011

1112
canvas.drawing { 🐢 in

0 commit comments

Comments
 (0)