Skip to content

Commit bc9e39b

Browse files
author
JWI
committed
patching ios 7 now
1 parent 2c04de7 commit bc9e39b

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/UIKitBackend/UIKitBackend+Window.swift

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,16 @@ final class RootViewController: UIViewController {
6666
childController.didMove(toParent: self)
6767
}
6868
childWidget = child
69-
70-
NSLayoutConstraint.activate([
69+
70+
71+
72+
/*NSLayoutConstraint.activate([
7173
child.view.widthAnchor.constraint(equalTo: view.safeAreaLayoutGuide.widthAnchor),
7274
child.view.heightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.heightAnchor),
73-
])
75+
])*/
76+
77+
child.view.frame = view.bounds
78+
child.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
7479
}
7580
}
7681

@@ -108,8 +113,13 @@ extension UIKitBackend {
108113
// area insets aren't even part of the window.
109114
// If/when this is updated, ``RootViewController`` and ``WidgetProtocolHelpers`` will
110115
// also need to be updated.
111-
let size = window.safeAreaLayoutGuide.layoutFrame.size
112-
return SIMD2(Int(size.width), Int(size.height))
116+
if #available(iOS 11, *) {
117+
let size = window.safeAreaLayoutGuide.layoutFrame.size
118+
return SIMD2(Int(size.width), Int(size.height))
119+
} else {
120+
let size = window.bounds.size
121+
return SIMD2(Int(size.width), Int(size.height))
122+
}
113123
}
114124

115125
public func setResizeHandler(

0 commit comments

Comments
 (0)