Skip to content

Commit fe46147

Browse files
committed
🧹 Clean up views
1 parent c1e41ee commit fe46147

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

‎Sources/ShinySwiftUI/Extensions/SwiftUI/View/View+Tooltip.swift‎

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ fileprivate struct TooltipView<Content, TooltipContent>: View where Content: Vie
3131
var hover: Binding<Bool>?
3232
var extraOffset: CGFloat = 0.0
3333
@State private var autoHover: Bool = false
34-
@State private var contentHeight: CGFloat = 0.0
3534

3635
var show: Bool {
3736
if let hover = hover {
@@ -42,27 +41,22 @@ fileprivate struct TooltipView<Content, TooltipContent>: View where Content: Vie
4241
}
4342

4443
var body: some View {
45-
GeometryReader { proxy in
46-
content
47-
.onAppear {
48-
contentHeight = proxy.size.height
44+
content
45+
.onHover {
46+
if hover == nil {
47+
autoHover = $0
4948
}
50-
}
51-
.onHover {
52-
if hover == nil {
53-
autoHover = $0
5449
}
55-
}
56-
.overlay(
57-
tooltipContent
58-
.padding(.xs)
59-
.background(background)
60-
.cornerRadius(.s)
61-
.roundedBorder(Color.primary.opacity(0.2), cornerRadius: .s)
62-
.opacity(show ? .opaque : .invisible)
63-
.offset(y: show ? -35.0 - extraOffset : -25.0)
64-
.slickAnimation(value: show)
65-
)
50+
.overlay(
51+
tooltipContent
52+
.padding(.xs)
53+
.background(background)
54+
.cornerRadius(.s)
55+
.roundedBorder(Color.primary.opacity(0.2), cornerRadius: .s)
56+
.opacity(show ? .opaque : .invisible)
57+
.offset(y: show ? -35.0 - extraOffset : -25.0)
58+
.slickAnimation(value: show)
59+
)
6660
}
6761

6862
var background: some View {

0 commit comments

Comments
 (0)