Popularity
6.9
Stable
Activity
2.8
-
929
12
63

Programming language: Swift
License: MIT License
Tags: UI     Alert    
Latest version: v2.1.4

SPAlert alternatives and similar libraries

Based on the "Alert" category.
Alternatively, view SPAlert alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of SPAlert or a related project?

Add another 'Alert' Library

README

SPAlert

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, don't forget to put star ★ and follow me on GitHub:

https://github.com/ivanvorobei

Navigate

Requirements

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

Installation

CocoaPods:

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:

https://github.com/ivanvorobei/SPAlert

Carthage

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"

Manually

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!")

Usage

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

Duration

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
alertView.present()

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.

Layout

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

Haptic

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

Other Projects

SPPermissions

Allow request permissions with native dialog UI and interactive animations. Also you can request permissions without dialog. Check state any permission. You can start using this project with just two lines of code and easy customisation.

SPDiffable

Apple's diffable API requerid models for each object type. If you want use it in many place, you pass many time to implemenet and get over duplicates codes. This project help you do it elegant with shared models and special cell providers for one-usage models.

Russian Community

Присоединяйтесь в телеграм канал Код Воробья, там найдете заметки о iOS разработке и дизайне. Большие туториалы выклыдываю на YouTube.

Tutorials on YouTube