mirror of
https://github.com/jphong1111/awesome-ios-developer.git
synced 2025-07-21 05:10:02 +07:00
Update README.md
This commit is contained in:
20
README.md
20
README.md
@ -395,25 +395,25 @@ And then go to **RUN** and check **THREAD SANITIZER** 👈
|
|||||||
Copy this code and Paste into your controller
|
Copy this code and Paste into your controller
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
|
#if canImport(SwiftUI) && DEBUG
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
struct SwiftLeeViewRepresentable: UIViewRepresentable {
|
||||||
struct ViewControllerRepresentable: UIViewControllerRepresentable {
|
func makeUIView(context: Context) -> UIView {
|
||||||
typealias UIViewControllerType = ViewController
|
return UIStoryboard(name: "Main", bundle: Bundle.main).instantiateInitialViewController()!.view
|
||||||
|
|
||||||
func makeUIViewController(context: Context) -> ViewController {
|
|
||||||
return ViewController()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateUIViewController(_ uiViewController: ViewController, context: Context) {
|
func updateUIView(_ view: UIView, context: Context) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS 13.0.0, *)
|
@available(iOS 13.0, *)
|
||||||
struct ViewPreview: PreviewProvider {
|
struct SwiftLeeViewController_Preview: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
ViewControllerRepresentable()
|
SwiftLeeViewRepresentable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
```
|
```
|
||||||
|
|
||||||
Enable canvas option like this
|
Enable canvas option like this
|
||||||
|
Reference in New Issue
Block a user