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
25 changes: 25 additions & 0 deletions Sources/SPIndicator/Extensions/UIApplicationExtension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// UIApplicationExtension.swift
// SPIndicator
//
// Created by flexih on 2023/7/29.
//

#if os(visionOS)
import UIKit

public extension UIApplication {
var keyWindow: UIWindow? {
for scene in UIApplication.shared.connectedScenes {
if scene.activationState == .foregroundActive,
let sceneDeleate = (scene as? UIWindowScene)?.delegate as? UIWindowSceneDelegate,
let window = sceneDeleate.window {
return window
}
}
print("\(#function): Failed to retrieve the window.")
return nil
}
}

#endif
4 changes: 3 additions & 1 deletion Sources/SPIndicator/SPIndicatorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ open class SPIndicatorView: UIView {

private lazy var backgroundView: UIVisualEffectView = {
let view: UIVisualEffectView = {
if #available(iOS 13.0, *) {
if #available(iOS 26.0, *) {
return UIVisualEffectView(effect: UIGlassEffect(style: .regular))
} else if #available(iOS 13.0, *) {
return UIVisualEffectView(effect: UIBlurEffect(style: .systemThickMaterial))
} else {
return UIVisualEffectView(effect: UIBlurEffect(style: .light))
Expand Down
2 changes: 1 addition & 1 deletion Sources/SPIndicator/Services/SPIndicatorHaptic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public enum SPIndicatorHaptic {
case none

func impact() {
#if os(iOS)
#if os(iOS) && !os(visionOS)
let generator = UINotificationFeedbackGenerator()
switch self {
case .success:
Expand Down