Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 19 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public enum AlertViewStyle {

- [Installation](#installation)
- [Swift Package Manager](#swift-package-manager)
- [CocoaPods](#cocoapods)
- [SwiftUI](#swiftui)
- [Present & Dismiss](#present--dismiss)
- [Customisation](#customisation)
Expand All @@ -56,31 +55,17 @@ Ready to use on iOS 13+. Supports iOS and visionOS. Working with `UIKit` and `Sw
In Xcode go to Project -> Your Project Name -> `Package Dependencies` -> Tap _Plus_. Insert url:

```
https://github.com/sparrowcode/AlertKit
https://github.com/eladdekel/AlertKit
```

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

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

### CocoaPods:

This is an outdated way of doing things. I advise you to use [SPM](#swift-package-manager). However, I will continue to support Cocoapods for some time.

<details><summary>Cocoapods Installation</summary>

[CocoaPods](https://cocoapods.org) is a dependency manager. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your `Podfile`:

```ruby
pod 'SPAlert'
```

</details>

### 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`.
Expand Down Expand Up @@ -109,6 +94,21 @@ alertView.titleLabel.font = UIFont.systemFont(ofSize: 21)
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:

```swift
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.
Expand All @@ -128,18 +128,6 @@ For dismiss all alerts that was presented:
AlertKitAPI.dismissAllAlerts()
```

## Apps Using

<p float="left">
<a href="https://apps.apple.com/app/id1624477055"><img src="https://cdn.sparrowcode.io/github/apps-using/id1624477055.png?v=2" height="65"></a>
<a href="https://apps.apple.com/app/id1625641322"><img src="https://cdn.sparrowcode.io/github/apps-using/id1625641322.png?v=2" height="65"></a>
<a href="https://apps.apple.com/app/id1625641322"><img src="https://cdn.sparrowcode.io/github/apps-using/id6449774982.png?v=2" height="65"></a>
<a href="https://apps.apple.com/app/id875280793"><img src="https://cdn.sparrowcode.io/github/apps-using/id875280793.png?v=2" height="65"></a>
<a href="https://apps.apple.com/app/id743843090"><img src="https://cdn.sparrowcode.io/github/apps-using/id743843090.png?v=2" height="65"></a>
<a href="https://apps.apple.com/app/id537070378"><img src="https://cdn.sparrowcode.io/github/apps-using/id537070378.png?v=2" height="65"></a>
<a href="https://apps.apple.com/app/id1617055933"><img src="https://cdn.sparrowcode.io/github/apps-using/id1617055933.png?v=2" height="65"></a>
<a href="https://apps.apple.com/app/id1668579869"><img src="https://cdn.sparrowcode.io/github/apps-using/id1668579869.png?v=1" height="65"></a>
<a href="https://apps.apple.com/app/id6451087813"><img src="https://cdn.sparrowcode.io/github/apps-using/id6451087813.png?v=1" height="65"></a>
</p>
## Disclaimer

If you use a `AlertKit`, add your app via Pull Request.
This is a fork of sparrowcode's [AlertKit](https://github.com/sparrowcode/AlertKit) to support iOS 26's tinted glass.
17 changes: 0 additions & 17 deletions SPAlert.podspec

This file was deleted.

29 changes: 22 additions & 7 deletions Sources/AlertKit/Views/AlertAppleMusic16View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class AlertAppleMusic16View: UIView, AlertViewProtocol {
public let titleLabel: UILabel?
public let subtitleLabel: UILabel?
public let iconView: UIView?

private let forceNonGlass: Bool

public static var defaultContentColor = UIColor { trait in
switch trait.userInterfaceStyle {
Expand All @@ -26,23 +28,36 @@ public class AlertAppleMusic16View: UIView, AlertViewProtocol {
fileprivate var completion: (()->Void)? = nil

private lazy var backgroundView: UIVisualEffectView = {
let view: UIVisualEffectView = {
let effect: UIVisualEffect = {
#if !os(tvOS)
if #available(iOS 26, *), !forceNonGlass {
let glass = UIGlassEffect()
glass.tintColor = UIColor { trait in
switch trait.userInterfaceStyle {
case .dark: return UIColor.white.withAlphaComponent(0.12)
default: return UIColor.black.withAlphaComponent(0.06)
}
}
return glass
}
if #available(iOS 13.0, *) {
return UIVisualEffectView(effect: UIBlurEffect(style: .systemThickMaterial))
return UIBlurEffect(style: .systemThickMaterial)
} else {
return UIVisualEffectView(effect: UIBlurEffect(style: .light))
return UIBlurEffect(style: .light)
}
#else
return UIVisualEffectView(effect: UIBlurEffect(style: .light))
return UIBlurEffect(style: .light)
#endif
}()
let view = UIVisualEffectView(effect: effect)
view.isUserInteractionEnabled = false
return view
}()

public init(title: String? = nil, subtitle: String? = nil, icon: AlertIcon? = nil) {


public init(title: String? = nil, subtitle: String? = nil, icon: AlertIcon? = nil, forceNonGlass: Bool = false) {

self.forceNonGlass = forceNonGlass

if let title = title {
let label = UILabel()
label.font = UIFont.preferredFont(forTextStyle: .title2, weight: .bold)
Expand Down
23 changes: 20 additions & 3 deletions Sources/AlertKit/Views/AlertAppleMusic17View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class AlertAppleMusic17View: UIView, AlertViewProtocol, AlertViewInternal
public let titleLabel: UILabel?
public let subtitleLabel: UILabel?
public let iconView: UIView?

private let forceNonGlass: Bool

public static var defaultContentColor = UIColor { trait in
#if os(visionOS)
Expand All @@ -38,14 +40,29 @@ public class AlertAppleMusic17View: UIView, AlertViewProtocol, AlertViewInternal
hostView.isUserInteractionEnabled = false
return hostView
#else
let view = UIVisualEffectView(effect: UIBlurEffect(style: .systemMaterial))
let effect: UIVisualEffect
if #available(iOS 26, *), !forceNonGlass {
let glass = UIGlassEffect()
glass.tintColor = UIColor { trait in
switch trait.userInterfaceStyle {
case .dark: return UIColor.white.withAlphaComponent(0.12)
default: return UIColor.black.withAlphaComponent(0.06)
}
}
effect = glass
} else {
effect = UIBlurEffect(style: .systemMaterial)
}
let view = UIVisualEffectView(effect: effect)
view.isUserInteractionEnabled = false
return view
#endif
}()

public init(title: String? = nil, subtitle: String? = nil, icon: AlertIcon? = nil) {

public init(title: String? = nil, subtitle: String? = nil, icon: AlertIcon? = nil, forceNonGlass: Bool = false) {

self.forceNonGlass = forceNonGlass

if let title = title {
let label = UILabel()
label.font = UIFont.preferredFont(forTextStyle: .body, weight: .semibold, addPoints: -2)
Expand Down