Skip to content

Commit 21f38de

Browse files
constantine-frymeta-codesync[bot]
authored andcommitted
Add another sample for view controllers.
Reviewed By: saadhzahid Differential Revision: D88157540 fbshipit-source-id: 2271517051f30ca8d048046ec86e664b9b95c731
1 parent f723e5a commit 21f38de

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Sources/QuickLayout/docs/docs/how-to-use/manual-layout-integration-uiviewcontrollers.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,35 @@ final class MyViewController: UIViewController {
3030
}
3131
}
3232
```
33+
34+
## @QuickLayout view in a view controller
35+
36+
```swift
37+
@QuickLayout
38+
class MyView: UIView {
39+
var body: Layout {
40+
...
41+
}
42+
}
43+
44+
class ViewController: UIViewController {
45+
46+
let myView = MyView()
47+
48+
override func viewDidLoad() {
49+
super.viewDidLoad()
50+
view.addSubview(myView)
51+
}
52+
53+
var body: Layout {
54+
ZStack {
55+
myView
56+
}
57+
}
58+
59+
override func viewDidLayoutSubviews() {
60+
super.viewDidLayoutSubviews()
61+
body.applyFrame(view.bounds.inset(by: view.safeAreaInsets))
62+
}
63+
}
64+
```

0 commit comments

Comments
 (0)