Dark Mode

SPAlert (esta ligação abre numa nova janela) por PedroCavaleiro (esta ligação abre numa nova janela)

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


HCI Data Source: markdown, Import: https://raw.githubusercontent.com/PedroCavaleiro/SPAlert/master/Readme.md, Section:


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.

And more:

If you like the project, please do not forget to star ★ this repository and follow me on GitHub. To help out with the project, see the Сooperation section.

For an example of this plugin in use, check this app: Debts - Spending tracker for iOS and macOS. You can buy source code this apps in my store for iOS developers:

xcode-shop.com https://github.com/ivanvorobei



Swift 4.2 & 5.0. Ready for use on iOS 10+



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

pod 'SPAlert'

Swift Package Manager

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

To integrate SPAlert into your Xcode project using Xcode 11, specify it in File > Swift Packages > Add:



Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate SPAlert into your Xcode project using Carthage, specify it in your Cartfile:

github "ivanvorobei/SPAlert"


If you prefer not to use any of dependency managers, you can integrate SPAlert into your project manually. Put Source/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 the alerts by calling the class functions on SPAlert. These functions are updated regularly and show the alerts "the Apple way". I focus on presets:

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", image: UIImage(named: "Heart")!)

For showing a simple text message:

SPAlert.present(message: "Text!")

For showing a loading view without customization:

let alert = SPAlert.presentLoader(message: "Loading...")
alert.dismis() // To dismiss the alert

For showing a loading view without customization but with timeout:

let _ = SPAlert.presentLoader(message: "Loading...", timeout: 5)


If you require deep customization, this section will show you what you can do.


If you want the SPAlert to be shwon longer, use the duration property:

let alertView = SPAlertView(title: "Added to Library", message: nil, preset: SPAlertPreset.done)
alertView.duration = 3

Dark Mode

Dark Mode needs no additional configuration. As soon as the user changes their interface to dark, all alerts will follow suit.

This is achieved by checking the userInterfaceStyle property on traitCollection.:

if self.traitCollection.userInterfaceStyle == .dark {
    return true

It is available since iOS 12, for earlier iOS versions the alerts will always be shown in Light Mode.


To change the size and spacing of the alerts:

alertView.layout.topSpace = 18
alertView.layout.iconHeight = 25

For more properties see the class.

Dismiss by Tap

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

alertView.dismissByTap = false


If you use presets, the vibro-response will be started automatically. To customize this, you need set the haptic property:

alertView.haptic = .success

To disable haptics, set it to .none.

Corner Radius

You can change the corner radius by setting the cornerRadius property:

alertView.layer.cornerRadius = 40

Loading View

The loading view can be a square or it can calculate the size needed

let loadingView = SPAlertView(loadingMessage = "Loading...")
loadingView.makeLoadingViewRectangular = true // this is the default value

Background Blur

Background blur is available to the loading view as default or to the other alerts by adding to the configuration

let alertView = SPAlertView(title: "Added to Library", message: nil, preset: SPAlertPreset.done)
alertView.blurBackground = true // The default value for alerts is false

To change the blur background

let loadingView = SPAlertView(loadingMessage = "Loading...")
loadingView.backgroundBlurRadius = 10 // The default value is 5

Note: This only blurs the views under the alert or the loading view, and not the alert or loading view it self.


This project is free to use, but developing it takes time. Contributing to this project is a huge help. Here is list of tasks that need to be done:

  • Add documentation in the source files (description of public methods and parameters).
  • Help me translate my app Debts - Spending tracker for other languages.


SPAlert is released under the MIT license. Check LICENSE.md for details.