mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
695 B
Swift
22 lines
695 B
Swift
2 years ago
|
// Copyright © 2023 Rangeproof Pty Ltd. All rights reserved.
|
||
|
|
||
|
import Foundation
|
||
|
import SwiftUI
|
||
|
|
||
|
struct BezierPath: Shape {
|
||
|
let bezierPath: UIBezierPath
|
||
|
|
||
|
func path(in rect: CGRect) -> Path {
|
||
|
let path = Path(bezierPath.cgPath)
|
||
|
|
||
|
// Figure out how much bigger we need to make our path in order for it to fill the available space without clipping.
|
||
|
let multiplier = min(rect.width, rect.height)
|
||
|
|
||
|
// Create an affine transform that uses the multiplier for both dimensions equally.
|
||
|
let transform = CGAffineTransform(scaleX: multiplier, y: multiplier)
|
||
|
|
||
|
// Apply that scale and send back the result.
|
||
|
return path.applying(transform)
|
||
|
}
|
||
|
}
|