Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets. Support SwiftUI.

pushedAt 1 week ago



Popup from Apple Music & Feedback in AppStore. Contains Done, Heart, Error and other presets. Supports Dark Mode. I tried to recreate Apple's alerts as much as possible. You can find these alerts in the AppStore after feedback and after you add a song to your library in Apple Music. Support SwiftUI.

You can create more with custom images and SFSymbols more:

If you like the project, don't forget to put star ★
Check out my other libraries:



Ready for use on iOS 11+. Works with Swift 5+. Required Xcode 12.0 and higher.

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

Once you have your Swift package set up, adding as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/ivanvorobei/SPAlert", .upToNextMajor(from: "3.5.1"))


CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your Podfile:

pod 'SPAlert'


If you prefer not to use any of dependency managers, you can integrate manually. Put Sources/SPAlert folder in your Xcode project. Make sure to enable Copy items if needed and Create groups.

Quick Start

For best experience, I recommend presenting alerts by calling the class functions SPAlert. These functions are updated regularly and show the alerts as Apple way:

SPAlert.present(title: "Added to Library", preset: .done)

For using a custom image:

SPAlert.present(title: "Love", message: "We'll recommend more like this in For You", preset: .custom(UIImage.init(named: "heart")!))

For showing a simple text message:

SPAlert.present(message: "Something going wrong", haptic: .error)



For change duration of present time, create alert view and call present method with custom duration:

let alertView = SPAlertView(title: "Complete", preset: .done)
alertView.duration = 4

If you don't want to dimiss alert in time, disable dismissInTime. After it duration property will be ignored.

alertView.dismissInTime = false

In this case you shoud dismiss alert manually.


For customise layout and margins, use layout property. You can manage margins for each side, icon size and space between image and titles:

alertView.layout.iconSize = .init(width: 24, height: 24)
alertView.layout.margins.top = 12
alertView.layout.spaceBetweenIconAndTitle = 8

Dismiss by Tap

If you tap the alert, it will disappear. This can be disabled:

alertView.dismissByTap = false


For manage haptic, you shoud pass it in present method:

alertView.present(duration: 1.5, haptic: .success, completion: nil)

You can remove duration and completion, its have default values.


I added preset .spinner, for use it simple call this:

let alertView = SPAlertView(title: "Please, wait", preset: .spinner)

By default for this preset dismissInTime disabled and need manually dismiss alert.

Shared Appearance

Also you can change some default values for alerts. For example you can change default duration and corner radius for alert with next code:

SPAlertView.appearance().duration = 2
SPAlertView.appearance().cornerRadius = 12

It will apply for all alerts. I recomend set it in app delegate. But you can change it in runtime.


Use like system alert only show message tips:

Button("Show alert") {
    showAlert = true
}.spAlert(isPresent: $showAlert, message: "this is message only")

or show message, title, image and other configuration:

Button("Show alert") {
    showAlert = true
}.spAlert(isPresent: $showAlert, 
        title: "Alert title", 
        message: "Alert message",
        duration: 2.0, 
        dismissOnTap: false, 
        present: .custom(UIImage(systemName: "heart")!), 
        haptic: .success, 
        layout: .init(), 
        completion: {
            print("Alert is destory")

Russian Community

Подписывайся в телеграм-канал, если хочешь получать уведомления о новых туториалах.
Со сложными и непонятными задачами помогут в чате.

Видео-туториалы выклыдываю на YouTube:

Tutorials on YouTube

ucloud ads