Skip to content

Instantly share code, notes, and snippets.

@trilliwon
Created October 17, 2019 03:41
Show Gist options
  • Save trilliwon/8eb6cd54a02d7ebe6de3dd13d2acaf13 to your computer and use it in GitHub Desktop.
Save trilliwon/8eb6cd54a02d7ebe6de3dd13d2acaf13 to your computer and use it in GitHub Desktop.
Swiftui Close button
func closeButton(reader: GeometryProxy) -> some View {
Button(action: {
self.selectedPoster = nil
}) {
Circle()
.strokeBorder(Color.red, lineWidth: 1)
.background(Image(systemName: "xmark").foregroundColor(.red))
.frame(width: 50, height: 50)
}
.scaleEffect(self.innerSelectedPoster != nil ? 0 : 1)
.position(x: reader.frame(in: .local).midX,
y: reader.frame(in: .local).maxY - 40)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment