Account Deletion Confirmation

Account Deletion Confirmation

by dockui

A clean, user-friendly view for confirming permanent account deletion with warnings, a confirmation field, and clear action buttons.

Platform
SwiftUI
Code
Native Swift
Format
Screen
Access
Free

Code Snippet

struct AccountDeletionConfirmation: View {
    @State private var confirmationText: String = ""
    var body: some View {
        NavigationView {
            VStack(spacing: 32) {
                Spacer()
                // Warning Icon & Title
                VStack(spacing: 12) {
                    ZStack {
                        Circle()
                            .fill(LinearGradient(gradient: Gradient(colors: [Color.red.opacity(0.18), Color.orange.opacity(0.12)]), startPoint: .topLeading, endPoint: .bottomTrailing))
                            .frame(width: 80, height: 80)
                        Image(systemName: "exclamationmark.triangle.fill")
                            .font(.system(size: 44))
                            .foregroundColor(.red)
                    }
                    Text("Delete Account")
                        .font(.title2)
                        .fontWeight(.bold)
                    Text("This action is permanent and cannot be undone.")
                        .foregroundColor(.secondary)
                        .multilineTextAlignment(.center)
                }

                // Consequences List
                VStack(alignment: .leading, spacing: 8) {
                    Text("You will lose:")
                        .font(.headline)
                    HStack(alignment: .top, spacing: 8) {
                        Image(systemName: "person.crop.circle.badge.xmark")
                            .foregroundColor(.red)
                        Text("Your profile and all personal data")
                            .font(.subheadline)
                    }
                    HStack(alignment: .top, spacing: 8) {
                        Image(systemName: "message.fill")
                            .foregroundColor(.red)
                        Text("All your messages and conversations")
                            .font(.subheadline)
                    }
                    HStack(alignment: .top, spacing: 8) {
                        Image(systemName: "star.slash.fill")
                            .foregroundColor(.red)
                        Text("Saved items, favorites, and settings")
                            .font(.subheadline)
                    }
                }
                .frame(maxWidth: .infinity, alignment: .leading)
                .padding()
                .background(
                    RoundedRectangle(cornerRadius: 16, style: .continuous)
                        .fill(Color(.systemBackground).opacity(0.7))
                )
                .padding(.horizontal)

                // Confirmation Text Field
                VStack(alignment: .leading, spacing: 8) {
                    Text("Type 'DELETE' to confirm:")
                        .font(.subheadline)
                        .foregroundColor(.secondary)
                    TextField("DELETE", text: $confirmationText)
                        .textFieldStyle(RoundedBorderTextFieldStyle())
                        .autocapitalization(.allCharacters)
                }
                .padding(.horizontal)

                Spacer()
                // Confirm & Cancel Buttons
                HStack(spacing: 16) {
                    Button(action: {}) {
                        Text("Cancel")
                            .font(.headline)
                            .foregroundColor(.primary)
                            .frame(maxWidth: .infinity)
                            .padding()
                            .background(Color(.systemGray5))
                            .cornerRadius(14)
                    }
                    Button(action: {}) {
                        Text("Delete Account")
                            .font(.headline)
                            .foregroundColor(.white)
                            .frame(maxWidth: .infinity)
                            .padding()
                            .background(Color.red)
                            .cornerRadius(14)
                    }
                }
                .padding(.horizontal)
                .padding(.bottom, 24)
            }
            .navigationTitle("Confirm Deletion")
            .background(
                LinearGradient(gradient: Gradient(colors: [Color.red.opacity(0.10), Color.orange.opacity(0.08)]), startPoint: .top, endPoint: .bottom)
                    .ignoresSafeArea()
            )
        }
    }
} 

Similar Blogs

View All Articles
How to Translate Xcode String Catalogs with AI

How to Translate Xcode String Catalogs with AI

Learn how to efficiently translate Xcode string catalogs using AI fast, streamlining localization for your iOS and SwiftUI applications.

by dockui
May 4
How to optimize your SwiftUI app in 2026

How to optimize your SwiftUI app in 2026

Discover top strategies to optimize your SwiftUI app in 2026, enhancing performance, responsiveness, and maintainability with modern concurrency.

by dockui
Apr 29
SwiftUI: iOS Confirmation Alert (Confirm + Cancel)

SwiftUI: iOS Confirmation Alert (Confirm + Cancel)

SwiftUI iOS confirmation alert with Confirm and Cancel buttons. Beginners guide to building safe actions, destructive deletes, and commit dialogs.

by dockui
Nov 11
SwiftUI: IOS Haptic Feedback Guide 2026

SwiftUI: IOS Haptic Feedback Guide 2026

Add click to vibrate haptic feedback in SwiftUI. Full guide to UIImpactFeedbackgenerator, success, error, selection, and tap vibration patterns with code.

by dockui
Nov 11

Code copied to clipboard!