Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
Remove dead code
  • Loading branch information
Jens Troest committed Mar 22, 2024
1 parent 0d7f961 commit 6ed9d6a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 32 deletions.
24 changes: 0 additions & 24 deletions AutographDemo/AutographDemo/AutographCardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,6 @@ struct AutographCardView: View {

}

/*
extension Array where Element == [CGPoint] {
/// Useful for creating sample data from real data
func printPoints() {
print("[\n")
self.enumerated().forEach { index, stroke in
print("[")
stroke.enumerated().forEach { index, point in
print("CGPoint(x: \(point.x), y: \(point.y))")
if index != stroke.count - 1 {
print(",")
}
}
print("]")
if index != stroke.count - 1 {
print(",\n")
}
}
print("]")
}
}
*/

#Preview {
MainActor.assumeIsolated {
let container = previewContainer
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ var body: some View {
}
```

## Dependencies

It has a dependency to my utility package [SwiftUIHelpers](https://github.com/jensmoes/swift-ui-helpers) for tracking the canvas size, as well as the [SwiftDocCPlugin](https://github.com/apple/swift-docc-plugin) for generating documentation.

## Rendering in SwiftUI

To display the autograph in a view you can use the provided ``AutographShape`` implementation of [Shape](https://developer.apple.com/documentation/swiftui/shape), or use the ``path(in:)`` extension directly to create more advanced shapes.
Expand Down
8 changes: 0 additions & 8 deletions Sources/Autograph/Extensions/Array+Path.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ public extension Array where Element == [CGPoint] {
"L\(to.x) \(to.y) "
}

private var maxX: CGFloat {
2
}
/**
Generates a string representation of the path as SVG
- Parameters:
Expand All @@ -82,17 +79,12 @@ public extension Array where Element == [CGPoint] {
"""

// guard let firstPoint = strokes.first?.first else { return nil }

// Point transform from normalized form
let transform = CGAffineTransform(scaleX: canvas.width, y: canvas.height)

// String representation of the signature in SVG format
var svg = xmlHeader + svgHeader // Add the SVG headers

// Begin first path
// var path = pathHeader + move(to: firstPoint)

forEach { stroke in
if stroke.isEmpty {return} // Ignore empty
var path = pathHeader + move(to: stroke.first!.applying(transform)) // Force unwrap OK
Expand Down

0 comments on commit 6ed9d6a

Please sign in to comment.