Skip to content

Instantly share code, notes, and snippets.

View htchaan's full-sized avatar

htc htchaan

  • Hong Kong
View GitHub Profile
extension View {
func flexible(width: Bool, height: Bool) -> some View {
self.modifier(MatchingParentModifier(width: width, height: height))
}
}
struct MatchingParentModifier: ViewModifier {
@State private var intrinsicSize: CGSize = UIScreen.main.bounds.size
private let intrinsicWidth: Bool
private let intrinsicHeight: Bool