mirror of
https://github.com/lux-tel/session-ios.git
synced 2026-10-30 20:38:32 +00:00
22 lines
695 B
Swift
22 lines
695 B
Swift
// 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)
|
|
}
|
|
}
|