Skip to content
Native popup from Apple Music & Feedback in AppStore. Contains Done & Heart presets.
Swift Ruby
Branch: master
Clone or download
Latest commit fd15aec Aug 14, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Update FUNDING.yml May 24, 2019
Resources Update colors for Dark Mode Jul 2, 2019
Source/SPAlert Update colors for Dark Mode Jul 2, 2019
.gitignore Update gitignore Aug 14, 2019
LICENSE Initial commit Apr 28, 2019
Package.swift Add SPM Aug 10, 2019
README.md Add SPM Aug 10, 2019
SPAlert.podspec Update colors for Dark Mode Jul 2, 2019

README.md

SPAlert

Popup from Apple Music & Feedback in AppStore. Contains Done & Heart presets. Done preset present with animation. Also support Dark Mode. I clone Apple's alerts as much as possible. You can find this alerts in AppStore after feedback, after added song to library in Apple Music.

You can download example Debts - Spending tracker app from AppStore.
For buy source code of app in preview, go to:

xcode-shop.com

See project's backers in Sponsors section.

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 Project > Swift Packages:

https://github.com/ivanvorobei/SPAlert

Manually

If you prefer not to use any of the aforementioned 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 call alerts by SPAlert. These functions are updated regularly and show as Apple way. I focus on presets:

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

Currently there are few presets. If you want to add a new preset, create a issue and describe how you see it. I will try to quickly add new presets.

If you want use custom image, use func:

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

For show simple text message, use:

SPAlert.present(message: "Empty UITextField")

Usage

Sometimes it may require deep customization. In this section, I will show you what you can do.

Duration

To change the time that the SPAlert will be shown, use property duration:

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

Dark Mode

The default mode is Dark Mode. No additional configuration is required. As soon as the user change the interface to dark, all alerts will appear dark.

For check state of user appearance I am use traitCollection:

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

It available since iOS 12, for early using always Light Mode.

Layout

Here you can change the sizes and spaces:

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

For more properties see class.

Dismiss by Tap

If you click on 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 start automatically. For customize this, you need set property haptic:

alertView.haptic = .success

For disable haptic, set it to .none.

Corner Radius

I use a corner radius like an Apple. If you need to change it, see the property cornerRadius:

alertView.layer.cornerRadius = 40

Required Presets

I will add new types and presets as needed. I will add animation and custom layout to them for a better experience. To know what presets need to be done, please inform me. You do not need to be shy. Make a new issue and describe what kind of graphics or animation you would like. I will try to quickly add new items.

Sponsors

Support me with a monthly donation and help me continue activities. After payment I add you to list of sponsor in my all projects with link to your profile. Become a sponsors

My projects

SPStorkController

SPStorkController is сontroller as in Apple Music, Podcasts and Mail apps. Simple adding close button and centering arrow indicator. Customizable height. Using custom TransitionDelegate. Check scroll's bounce for more interactive. Simple adding close button and centering arrow indicator. You can download example Debts - Spending tracker app from AppStore.

Alert you can find in SPAlert project. If you want to buy source code of app in preview, please, go to xcode-shop.com


SPPermission

SPPermission 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.

You can buy example Dialog & Dinamic animations in xcode-shop.com, see preview.


SPLarkController

SPLarkController transition between controllers. Translate to top. Make settings screen for application. You can add buttons and switches. The amount cells is not limited. You can start using project with just two lines of code and easy customisation. For implement settings as in preiew, see section Settings Controller.

You can download example app Code - Learn Swift & Design from AppStore. If you want to buy source code of app this app, please, go to xcode-shop.com.

License

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

You can’t perform that action at this time.