Files
VirtualBuddy/VirtualUI/Source/Components/LiquidGlassCompat/AnyInsettableShape.swift
Guilherme Rambo e19a74866c Liquid glass adoption (#677)
* Raise deployment target to macOS 14, bump version

* Integrate Liquid Glass compatibility components

* Fix onChange(of:) deprecation warnings

* Update project settings

* Improve styling of setup and configuration UI components

* Fix fatal error in VMSavedStatesController.preview

* Tweak session UI

* Do not use prominent button style in VM configuration sheet so it matches overall setup wizard style

* Fix incorrectly sized buttons in grouped lists
2026-05-22 09:47:01 -03:00

26 lines
737 B
Swift

import SwiftUI
/// This is a naive implementation that may not work with every type of shape.
public struct AnyInsettableShape: InsettableShape {
private var shape: AnyShape
private var inset: CGFloat = 0
private init(shape: AnyShape, inset: CGFloat) {
self.shape = shape
self.inset = inset
}
public init(_ shape: some InsettableShape) {
self.init(shape: AnyShape(shape), inset: 0)
}
public nonisolated func path(in rect: CGRect) -> Path {
let path = shape.path(in: rect.insetBy(dx: inset, dy: inset))
return path
}
public nonisolated func inset(by amount: CGFloat) -> some InsettableShape {
AnyInsettableShape(shape: shape, inset: amount)
}
}