.map { $0 as? UIWindowScene }
.compactMap { $0 }
Just use .compactMap { $0 as? UIWindowScene } :slightly_smiling_face:
Instead of filter/first, you can do:
.windows.first(where: \.isKeyWindow)
For walking chains, sequences if often useful, like:
for responder in sequence(first: hint, next: \.next) { ... }
Improve the getCurrentKeyWindow: