
Account Alert
by dockui
SwiftUI account alert card with bold warning icon, verification message, and call-to-action button UI useful for popup messages.
- Platform
- SwiftUI
- Code
- Native Swift
- Format
- Component
- Access
- Free
Code Snippet
import SwiftUI
struct AccountAlertView: View {
var body: some View {
ZStack {
Color(red: 0.94, green: 0.94, blue: 0.92)
.ignoresSafeArea()
VStack(alignment: .leading, spacing: 20) {
HStack(alignment: .top, spacing: 16) {
// Icon
ZStack {
Circle()
.fill(.white)
.frame(width: 38, height: 38)
Image(systemName: "exclamationmark.triangle.fill")
.font(.system(size: 18, weight: .bold))
.foregroundColor(Color(hex: "D32F2F"))
}
.padding(.top, 4)
// Text Content
VStack(alignment: .leading, spacing: 12) {
Text("Verification required")
.font(.system(size: 20, weight: .bold, design: .rounded))
.foregroundColor(.white)
.fixedSize(horizontal: false, vertical: true)
Text("Please update your security settings by 15 April to maintain full access to all premium features.")
.font(.system(size: 16, weight: .regular))
.foregroundColor(.white.opacity(0.9))
.lineSpacing(4)
.fixedSize(horizontal: false, vertical: true)
}
}
// Button
Button(action: {
// Action here
}) {
Text("Verify")
.font(.system(size: 16, weight: .bold))
.foregroundColor(Color(hex: "D32F2F"))
.padding(.horizontal, 24)
.padding(.vertical, 12)
.background(
Capsule()
.fill(.white)
)
}
.padding(.leading, 54)
}
.padding(24)
.background(
RoundedRectangle(cornerRadius: 28)
.fill(Color(hex: "D32F2F"))
)
.padding(20)
}
}
}
extension Color {
init(hex: String) {
let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
var int: UInt64 = 0
Scanner(string: hex).scanHexInt64(&int)
let a, r, g, b: UInt64
switch hex.count {
case 3: // RGB (12-bit)
(a, r, g, b) = (255, (int >> 8) * 17, (int >> 4 & 0xF) * 17, (int & 0xF) * 17)
case 6: // RGB (24-bit)
(a, r, g, b) = (255, int >> 16, int >> 8 & 0xFF, int & 0xFF)
case 8: // ARGB (32-bit)
(a, r, g, b) = (int >> 24, int >> 16 & 0xFF, int >> 8 & 0xFF, int & 0xFF)
default:
(a, r, g, b) = (1, 1, 1, 0)
}
self.init(
.sRGB,
red: Double(r) / 255,
green: Double(g) / 255,
blue: Double(b) / 255,
opacity: Double(a) / 255
)
}
}More Templates
More Templates
View All TemplatesSimilar Blogs
View All Articles
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
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 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
Add click to vibrate haptic feedback in SwiftUI. Full guide to UIImpactFeedbackgenerator, success, error, selection, and tap vibration patterns with code.
by dockui
Nov 11Code copied to clipboard!