Skip to content

ahmetbostanciklioglu/CustomAlertViewSwiftUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

🔔 Custom Alert View — SwiftUI

A lightweight, hand-built alert overlay in SwiftUI with a blurred backdrop and spring animation.

Platform Swift SwiftUI Xcode Stars Last Commit

📖 Overview

Custom Alert View is a small SwiftUI sample that demonstrates how to build a custom alert card from scratch instead of relying on the system .alert modifier. A toolbar button toggles a rounded alert card that appears over a scrolling list, while the underlying content is blurred to keep focus on the alert. The whole transition is driven by a single spring .animation, and a circular close button dismisses it.

✨ Features

  • Custom alert card overlaid on top of the main content using a ZStack, rather than the built-in system alert.
  • Spring-animated show/hide transition bound to a single @State flag.
  • Background list blurs (blur(radius:)) while the alert is presented to draw focus.
  • Circular red close button plus a toolbar toggle that switches between "Open" and "Close".
  • Reusable styling factored into View extension modifiers (alertModifiers, closeButtonModifiers, ListViewModifiers).
  • Centralized UI strings and SF Symbol names in a Constants enum.

📸 Preview

Custom alert view screenshot 1 Custom alert view screenshot 2 Custom alert view screenshot 3

🚀 Getting Started

git clone https://github.com/ahmetbostanciklioglu/CustomAlertViewSwiftUI.git
cd CustomAlertViewSwiftUI
open CustomAlertViewSwiftUI.xcodeproj

Once the project opens in Xcode, select an iOS Simulator (or a connected device) and press Command + R to build and run.

📋 Requirements

  • Xcode 26 or later
  • iOS 15.6+ deployment target
  • Swift 5.0

🧑‍💻 Author

Ahmet Bostancıklıoğlu@ahmetbostanciklioglu · ahmetbostancikli@gmail.com

⭐ If this helped you, consider giving the repo a star!

About

A hand-built SwiftUI custom alert overlay with a blurred backdrop and spring animation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages