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

Overview

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.

You can create more with custom images and SFSymbols more:

If you like the project, don't forget to put star ★ and follow me on GitHub:

https://github.com/ivanvorobei

Migration to 3.0v

I did remove other presets becouse its UIImage symbols. Now you can do it with any symbols image. List of its you can get in SF Symbols app. For get it, usage next:

// Create image from symbols
let image = UIImage.init(systemName: "pencil.and.outline")
// Create preset with custom image
let preset = SPAlertIconPreset.custom(image)
// Present `SPAlert`
SPAlert.present(title: "Title", message: "Message", preset: preset)

Navigate

Installation

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 12, specify it in File > Swift Packages > Add Package Dependency...:

https://github.com/ivanvorobei/SPAlert

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'

Manually

If you prefer not to use any of dependency managers, you can integrate SPAlert into your project 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)

Usage

Duration

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

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

Layout

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

Haptic

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.

Other Projects

SPPermissions

Using for request and check state of permissions. Available native UI for request multiple permissions at the same time. Simple integration and usage like 2 lines code.

SPPerspective

Animation of widgets from iOS 14. 3D transform with dynamic shadow. Video preview. Available deep customisation 3D and shadow. Also you can use static transform without animation.

SPDiffable

Simplifies working with animated changes in table and collections. Apple's diffable API required models for each object type. If you want use it in many place, you pass time to implement it and get over duplicates codes. This project help do it elegant with shared models and special cell providers. Support side bar iOS14 and already has native cell providers and views.

Russian Community

В телеграм-канале Код Воробья пишу о iOS разработке. Помощь можно найти в нашем чате.

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

Tutorials on YouTube

Issues
  • Color for icon in SwiftUI

    Color for icon in SwiftUI

    Is your feature request related to a problem? Please describe. Please add custom color support to icons in SwiftUI.

    Describe the solution you'd like Something, where you can define the color of the .error icon animation. It would be pretty nice!

    enhancement 
    opened by derech1e 14
  • Add new type of alert — Loading Alert

    Add new type of alert — Loading Alert

    If you think it's a bad idea to add a loading option, then let's discuss it, maybe you should simply open some of the SPAlert.swift API so anyone using your project can subclass and add things easily.

    Also, I noticed that when dark mode is enabled + multitasking on iPad, the blurred background is a little bit weird but I didn't find a solution yet.

    Last but not least, why you prefered going with some frame calculation instead of using the auto-layout magic?

    opened by mlouli 8
  • Dark Mode Not Working in iOS 13

    Dark Mode Not Working in iOS 13

    I'm using SPAlert in an app that has iOS 13 as the minimum target but in both light & dark modes on device, the alert always uses light mode.

    opened by adam-redboxmobile 7
  • More Preset

    More Preset

    Thank you for the amazing work you've done.

    I would like to suggest two important preset:

    • Cross

    • Warning

    Thanks again

    enhancement 
    opened by omarmhaimdat 7
  • startAnimating() and stopAnimating()

    startAnimating() and stopAnimating()

    Can you add it like this? Let's close it when we want to. Thank you

    opened by productdevbook 6
  • Alert appears behind keyboard if the keyboard is open.

    Alert appears behind keyboard if the keyboard is open.

    I'm using SPAlert in a passcode view. Whenever a user enters an incorrect password, SPAlert will show an alert message with an icon. However, the alert appears partly behind the keyboard that is open.

    Is there any layout option that resolves this?

    Version in use: 1.1.1

    enhancement wait more 
    opened by tijme 6
  • Loading View

    Loading View

    Hi,

    I suggested a Loading View a few months back and you pointed me to this repo mlouli/SPAlert

    I grabbed his changes but also made a few of my own

    you can show a alert in a simple yet fast way

    let alert = SPAlert.presentLoader(message: "Loading...")
    alert.dismis()
    

    If you want using the timeout it's also possible

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

    by default it makes the loading view as a rectangle, this is a preference of my own, but you may disable this option by

    let loadingView = SPAlertView(loadingMessage = "Loading...")
    loadingView.makeLoadingViewRectangular = false
    loadingView.present()
    

    this way it will use the normal calculations.

    I also updated the README.md to include this changes.

    This library was tested in SwiftUI and found no errors

    opened by PedroCavaleiro 6
  • Force dark mode

    Force dark mode

    In some cases, I need to use dark style alerts. How can I enable this?

    wait more 
    opened by snowtema 4
  • Feature Request

    Feature Request

    Hi,

    Don't know if possible, but can you add and loader to your library?

    Seems like this library is the only one that is working with Swift UI

    enhancement 
    opened by PedroCavaleiro 4
  • Change size of alert

    Change size of alert

    Is there any way that I can change the size of alert. Currently it's too big and I couldn't find any way to reduce the it.

    opened by asadali737 4
Releases(4.1.0)
Owner
Ivan Vorobei
iOS Developer
Ivan Vorobei
Now playing controller from Apple Music, Mail & Podcasts Apple's apps.

SPStorkController About Controller as in Apple Music, Podcasts and Mail apps. Help if you need customize height or suppport modal style in iOS 12. Sim

Ivan Vorobei 2.5k Jan 7, 2022
Now playing controller from Apple Music, Mail & Podcasts Apple's apps.

SPStorkController About Controller as in Apple Music, Podcasts and Mail apps. Help if you need customize height or suppport modal style in iOS 12. Sim

Ivan Vorobei 2.5k Jan 5, 2022
:heart: Floating Action Button for iOS

Floaty Floaty is simple floating action button for iOS. (formerly KCFloatingActionButton) Why change the name? Follow the swift naming convention. KCF

Lee Sun-Hyoup 1.4k Dec 30, 2021
SpriteKit Floating Bubble Picker (inspired by Apple Music) 🧲

Magnetic Magnetic is a customizable bubble picker like the Apple Music genre selection. Demo Video $ pod try Magnetic Features Adding/Removing Nodes

Lasha Efremidze 1.3k Jan 6, 2022
A library to recreate the iOS Apple Music now playing transition

DeckTransition DeckTransition is an attempt to recreate the card-like transition found in the iOS 10 Apple Music and iMessage apps. Hereʼs a GIF showi

Harshil Shah 2.2k Jan 5, 2022
Custom interactive transition like Apple Music iOS App (iOS 9). written in Swift.

MusicPlayerTransition Custom interactive transition like Apple Music iOS App. written in Swift. Demo See demo on Appetize.io Using Transition Animator

Airin 640 Dec 29, 2021
Easy Haptic Feedback Generator 📳

Haptica is an easy haptic feedback generator. $ pod try Haptica Requirements iOS 9.0+ Xcode 8.0+ Swift 5 (Haptica 3.x), Swift 4 (Haptica 2.x), Swift

Lasha Efremidze 632 Jan 4, 2022
Lightweight dropdown message bar in Swift. It's simple and beautiful.

SwiftyDrop SwiftyDrop is a lightweight pure Swift simple and beautiful dropdown message. Features Easy to use like: Drop.down("Message") Message field

Morita Naoki 691 Dec 4, 2021
A message bar for iOS written in Swift.

Dodo, a message bar for iOS / Swift This is a UI widget for showing text messages in iOS apps. It is useful for showing short messages to the user, so

Evgenii Neumerzhitckii 873 Jan 12, 2022
A very flexible message bar for iOS written in Swift.

SwiftMessages Overview SwiftMessages is a very flexible view and view controller presentation library for iOS. Message views and view controllers can

SwiftKick Mobile 6.4k Jan 11, 2022
Dhiraj Rajendra Jadhao 198 Dec 12, 2021
PagingKit provides customizable menu UI. It has more flexible layout and design than the other libraries.

PagingKit provides customizable menu & content UI. It has more flexible layout and design than the other libraries. What's this? There are many librar

Kazuhiro Hayashi 1.2k Jan 1, 2022
Cool Animated music indicator view written in Swift

Cool Animated music indicator view written in Swift. ESTMusicIndicator is an implementation of NAKPlaybackIndicatorView in Swift for iOS 8. 本人著作的书籍《La

Aufree 455 Dec 13, 2021
A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram)

Unfortunately, life gets in the way sometimes and I won't be able to maintain this library any longer and upgrade this library to where it needs to be

null 5.2k Dec 23, 2021
Customizable simple Alert and simple ActionSheet for Swift

SimpleAlert It is simple and easily customizable alert. Can be used as UIAlertController. Appetize's Demo Requirements Swift 5.0 iOS 9.0 or later How

Kyohei Ito 393 Jan 15, 2022
PMAlertController is a great and customizable alert that can substitute UIAlertController

PMAlertController is a small library that allows you to substitute Apple's uncustomizable UIAlertController, with a beautiful and totally customizable

Paolo Musolino 2.4k Jan 6, 2022
Highly customizable alertview and alert/notification/success/error/alarm popup written in Swift

CDAlertView is highly customizable alert popup written in Swift. Usage is similar to UIAlertController. Screenshots Animations Usage Basic usage witho

Candost Dagdeviren 1.1k Jan 3, 2022
Beautiful animated Alert View. Written in Swift

SCLAlertView Animated Alert View written in Swift, which can be used as a UIAlertView or UIAlertController replacement. Since UIAlertView is deprecate

Viktor Radchenko 5.2k Jan 11, 2022
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.

Introduction Popup Dialog is a simple, customizable popup dialog written in Swift. Features Easy to use API with hardly any boilerplate code Convenien

Orderella Ltd. 3.7k Jan 6, 2022