Skip to content

eladdekel/AlertKit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

330 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AlertKit

Popup from Apple Music & Feedback in AppStore. Contains Done, Heart, Error and other. 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.

Alert Kit v5

For UIKit & SwiftUI call this:

AlertKitAPI.present(
    title: "Added to Library",
    icon: .done,
    style: .iOS17AppleMusic,
    haptic: .success
)

Available 2 styles:

public enum AlertViewStyle {

    case iOS16AppleMusic
    case iOS17AppleMusic
}

iOS Dev Community

Navigate

Installation

Ready to use on iOS 13+. Supports iOS and visionOS. Working with UIKit and SwiftUI.

Swift Package Manager

In Xcode go to Project -> Your Project Name -> Package Dependencies -> Tap Plus. Insert url:

https://github.com/eladdekel/AlertKit

or adding it to the dependencies of your Package.swift:

dependencies: [
    .package(url: "https://github.com/eladdekel/AlertKit", .upToNextMajor(from: "5.1.8"))
]

Manually

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

SwiftUI

You can use basic way via AlertKitAPI or call via modifier:

let alertView = AlertAppleMusic17View(title: "Hello", subtitle: nil, icon: .done)

VStack {}
    .alert(isPresent: $alertPresented, view: alertView)

Customisation

If you need customisation fonts, icon, colors or any other, make view:

let alertView = AlertAppleMusic17View(title: "Added to Library", subtitle: nil, icon: .done)

// change font
alertView.titleLabel.font = UIFont.systemFont(ofSize: 21)
// change color
alertView.titleLabel.textColor = .white

Liquid Glass (iOS 26+)

On iOS 26 and later, both AlertAppleMusic16View and AlertAppleMusic17View automatically upgrade their background to a tinted UIGlassEffect. On older iOS versions they fall back to the original blur material, so no caller changes are required.

If you want to opt out and force the classic blur on iOS 26+, pass forceNonGlass: true at construction time:

let alertView = AlertAppleMusic17View(title: "Added to Library", subtitle: nil, icon: .done, forceNonGlass: true)

// also available on the iOS 16 style
let alertView16 = AlertAppleMusic16View(title: "Added to Library", subtitle: nil, icon: .done, forceNonGlass: true)

The flag must be set at init — the background effect is built during initialisation, so a property change afterwards would have no effect.

Present & Dismiss

You can present and dismiss alerts manually via view.

let alertView = AlertAppleMusic17View(title: "Added to Library", subtitle: nil, icon: .done)

// present
alertView.present(on: self)
// and dismiss
alertView.dismiss()

For dismiss all alerts that was presented:

AlertKitAPI.dismissAllAlerts()

Disclaimer

This is a fork of sparrowcode's AlertKit to support iOS 26's tinted glass.

About

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

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Swift 100.0%