-
Notifications
You must be signed in to change notification settings - Fork 407
Closed
Description
UIWindowScene contains a lot of contextual information about the current window, and SwiftUI currently has no corresponding API to get this environment information. Therefore, I propose to support getting the parent UIWindowScene from a View.
Code snippets that may be useful:
struct SomeIntrospectionHelperView: UIViewRepresentable {
func makeUIView(context: Context) -> UnderlyingView {
UnderlyingView()
}
func updateUIView(_ view: UnderlyingView, context: Context) {
}
class UnderlyingView: UIView {
init() {
super.init(frame: .zero)
}
required init?(coder: NSCoder) {
super.init(frame: .zero)
}
override func willMove(toWindow newWindow: UIWindow?) {
super.willMove(toWindow: newWindow)
if let scene = newWindow?.windowScene {
// we got window scene here, 👀 callback introspect delegate...
}
}
}
}sebj and freysie
Metadata
Metadata
Assignees
Labels
No labels