Skip to content

Commit

Permalink
1.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nathantannar4 committed Feb 29, 2024
1 parent b71236b commit 095344c
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// Copyright (c) Nathan Tannar
//

import SwiftUI

@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
public struct ProposedSizeObserver: ViewModifier {
@Binding var size: ProposedSize

public init(size: Binding<ProposedSize>) {
self._size = size
}

public func body(content: Content) -> some View {
content
.background(
GeometryReader { proxy in
Color.clear
.hidden()
.onAppearAndChange(of: proxy.size) { size = ProposedSize(size: $0) }
.onDisappear { size = .unspecified }
}
)
}
}

0 comments on commit 095344c

Please sign in to comment.