I’ve a geometry reader that I’m utilizing for a parralax scrolling animation. It really works nice, however I wish to overlay the embedded picture with two buttons, one for location and an ellipsis. Nevertheless, neither of them appears to register the person tapping. I do know geometry readers can have a repute for altering the format so any steerage can be useful:
VStack {
GeometryReader(content material: { proxy in
let cardSize = proxy.measurement
let minX = min(proxy.body(in: .scrollView).minX * 1.4, proxy.measurement.width * 1.4)
WebImage(url: URL(string: card.postImagePathUrl))
.resizable()
.aspectRatio(contentMode: .fill)
.scaleEffect(1.25)
.offset(x: -minX)
.body(width: cardSize.width, peak: UIScreen.foremost.bounds.peak / 2)
.overlay (alignment: .topTrailing) {
OverlayMenu(card: card)
}
.clipShape(.rect(cornerRadius: 15))
.shadow(coloration: .black.opacity(0.25),radius: 8,x: 5, y:10)
})
.body(width: UIScreen.foremost.bounds.width - 60, peak: UIScreen.foremost.bounds.peak / 2)
.scrollTransition(.interactive, axis: .horizontal) { view, section in
view.scaleEffect(section.isIdentity ? 1: 0.95)
}
HStack (spacing: 5) {
VStack {
Picture(systemName: postCellModel.didLikePost ? "coronary heart.fill" : "coronary heart")
.body(width: 35, peak: 35)
.fontWeight(.semibold)
.font(.largeTitle)
}
.padding()
.onTapGesture {
postCellModel.didLikePost.toggle()
if (postCellModel.didLikePost) {
postCellModel.likeCount += 1
postsViewModel.incrementPostLikes(postId: card.id, newLikeCount: (postCellModel.likeCount), ownerId: card.ownerId)
} else {
postCellModel.likeCount -= 1
postsViewModel.decrementPostLikes(postId: card.id, newLikeCount: (postCellModel.likeCount), ownerId: card.ownerId)
}
}
.sensoryFeedback(.improve, set off: postCellModel.didLikePost)
VStack {
Picture(systemName: "paperplane")
.body(width: 35, peak: 35)
.fontWeight(.semibold)
.font(.largeTitle)
}
.padding()
}
.onTapGesture {
print("Bar tapped")
}
Spacer()
}
.body(peak: UIScreen.foremost.bounds.peak / 1.5)`
ViewBuilder
func OverlayMenu(card: Put up) -> some View {
VStack {
HStack {
HStack {
Textual content("Malibu, California")
.padding(.horizontal)
.padding(.vertical, 5)
}
.onTapGesture {
print("Location clicked")
}
.fontWeight(.semibold)
.background(.ultraThinMaterial)
.masks {
RoundedRectangle(cornerRadius: 15)
}
.onTapGesture {
print("Location")
}
Spacer()
Menu {
Button(motion: {print("Pressed me")}, label: {
Textual content("Report")
})
} label: {
Picture(systemName: "ellipsis")
.font(.title)
}
}
.foregroundStyle(.white)
}
.background(.blue)
.onTapGesture {
print("Tapped")
}
.padding(20)
}
I attempted fixing up and setting handbook body dimensions, however I am simply confused on learn how to correctly handle a geometry reader in my opinion.