2025-01-13 22:34:51 +01:00

37 lines
777 B
Swift

import SwiftUI
import SFSafeSymbols
struct TextWithPopup: View {
let symbol: SFSymbol
let text: LocalizedStringKey
let items: [String]
@State
private var isHovering = false
var body: some View {
HStack {
Image(systemSymbol: symbol)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 16, height: 16)
Text(text)
}
.contentShape(Rectangle())
.onTapGesture {
if items.count > 0 {
isHovering.toggle()
}
}
.sheet(isPresented: $isHovering) {
ListPopup(items: items)
.onTapGesture {
isHovering.toggle()
}
}
}
}