Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import SwiftUI
- struct SampleView: View {
- @Namespace private var namespace
- let dim = 175.0
- @State private var showDeleteButton = false
- var body: some View {
- ZStack(alignment: .bottomTrailing) {
- Color
- .black
- .opacity(0.8)
- .ignoresSafeArea()
- VStack {
- GlassEffectContainer {
- HStack {
- Button {
- } label: {
- Image(systemName: "square.and.arrow.up")
- }
- Spacer()
- HStack {
- Button {
- } label: {
- Image(systemName: "heart")
- }
- Button {
- } label: {
- Image(systemName: "info")
- }
- Button {
- } label: {
- Image(systemName: "slider.horizontal.3")
- }
- }.glassEffectUnion(id: "namespace", namespace: namespace)
- Spacer()
- Button {
- withAnimation(.bouncy) {
- showDeleteButton.toggle()
- }
- } label: {
- Image(systemName: "square.and.arrow.up")
- }
- }
- .buttonStyle(.glass)
- }
- }
- .padding()
- .frame(maxHeight: .infinity, alignment: .bottom)
- if showDeleteButton {
- VStack {
- Text("This photo will be deleted from the library. It will be in Recently Deleted for 30 days.")
- .foregroundStyle(.white)
- .font(.subheadline)
- Button(role: .destructive) {
- } label: {
- Text("Delete Photo")
- }.buttonStyle(.glassProminent)
- }
- .padding()
- .glassEffect(.clear, in: RoundedRectangle(cornerRadius: 15))
- .frame(width: dim, height: dim)
- .padding()
- .transition(
- .scale(scale: 0.1, anchor: .bottomTrailing)
- .combined(with: .opacity)
- )
- }
- }
- }
- }
- #Preview {
- SampleView()
- }
Advertisement
Add Comment
Please, Sign In to add comment