Guest User

Sample

a guest
Dec 26th, 2025
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 3.08 KB | None | 0 0
  1. import SwiftUI
  2.  
  3. struct SampleView: View {
  4.     @Namespace private var  namespace
  5.     let dim = 175.0
  6.     @State private var showDeleteButton = false
  7.    
  8.     var body: some View {
  9.         ZStack(alignment: .bottomTrailing) {
  10.             Color
  11.                 .black
  12.                 .opacity(0.8)
  13.                 .ignoresSafeArea()
  14.            
  15.             VStack {
  16.                 GlassEffectContainer {
  17.                    
  18.                     HStack {
  19.                         Button {
  20.                            
  21.                         } label: {
  22.                             Image(systemName: "square.and.arrow.up")
  23.                         }
  24.                        
  25.                         Spacer()
  26.                        
  27.                         HStack {
  28.                             Button {
  29.                                
  30.                             } label: {
  31.                                 Image(systemName: "heart")
  32.                             }
  33.                            
  34.                             Button {
  35.                                
  36.                             } label: {
  37.                                 Image(systemName: "info")
  38.                             }
  39.                             Button {
  40.                                
  41.                             } label: {
  42.                                 Image(systemName: "slider.horizontal.3")
  43.                             }
  44.                         }.glassEffectUnion(id: "namespace", namespace: namespace)
  45.                        
  46.                         Spacer()
  47.                        
  48.                         Button {
  49.                             withAnimation(.bouncy) {
  50.                                 showDeleteButton.toggle()
  51.                             }
  52.                         } label: {
  53.                             Image(systemName: "square.and.arrow.up")
  54.                         }
  55.                     }
  56.                     .buttonStyle(.glass)
  57.                    
  58.                 }
  59.             }
  60.             .padding()
  61.             .frame(maxHeight: .infinity, alignment: .bottom)
  62.            
  63.            
  64.             if showDeleteButton {
  65.                 VStack {
  66.                     Text("This photo will be deleted from the library. It will be in Recently Deleted for 30 days.")
  67.                         .foregroundStyle(.white)
  68.                         .font(.subheadline)
  69.                    
  70.                     Button(role: .destructive) {
  71.                        
  72.                     } label: {
  73.                         Text("Delete Photo")
  74.                     }.buttonStyle(.glassProminent)
  75.                        
  76.                 }
  77.                 .padding()
  78.                 .glassEffect(.clear, in: RoundedRectangle(cornerRadius: 15))
  79.                 .frame(width: dim, height: dim)
  80.                     .padding()
  81.                     .transition(
  82.                             .scale(scale: 0.1, anchor: .bottomTrailing)
  83.                             .combined(with: .opacity)
  84.                         )
  85.             }
  86.         }
  87.     }
  88.        
  89. }
  90.  
  91. #Preview {
  92.     SampleView()
  93. }
  94.  
Advertisement
Add Comment
Please, Sign In to add comment