Files
ux/ios/Classes/NativePlugin.swift
2026-04-22 22:42:53 +03:00

24 lines
722 B
Swift

import Flutter
import UIKit
public protocol NativePlugin {
func register(with registrar: FlutterPluginRegistrar)
}
public enum UxWindow {
public static var keyWindow: UIWindow? {
if let w = UIApplication.shared.delegate?.window ?? nil { return w }
for scene in UIApplication.shared.connectedScenes {
guard let ws = scene as? UIWindowScene else { continue }
for window in ws.windows where window.isKeyWindow { return window }
}
return nil
}
public static var topViewController: UIViewController? {
var vc = keyWindow?.rootViewController
while let presented = vc?.presentedViewController { vc = presented }
return vc
}
}