Skip to content

Commit

Permalink
Merge pull request #1 from gewill/main
Browse files Browse the repository at this point in the history
Replace UIBezierPath with Path to adapt multi-platform
  • Loading branch information
MrChens authored Mar 11, 2022
2 parents a7ea42c + f64161f commit f0db321
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Sources/SineWaveShape/SineWaveShape.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
*/
import SwiftUI

#if canImport(UIKit)

public struct SineWaveShape: Shape {

public var animatableData: Double {
Expand Down Expand Up @@ -65,7 +63,7 @@ public struct SineWaveShape: Shape {
}

public func path(in rect: CGRect) -> Path {
let path = UIBezierPath()
var path = Path()
let width = Double(rect.width)
let height = Double(rect.height)
let midWidth = width / 2
Expand Down Expand Up @@ -102,8 +100,7 @@ public struct SineWaveShape: Shape {

path.addLine(to: CGPoint(x: rect.width, y: rect.height))
path.addLine(to: CGPoint(x: 0, y: rect.height))
path.close()
return Path(path.cgPath)
path.closeSubpath()
return path
}
}
#endif

0 comments on commit f0db321

Please sign in to comment.