import PlaygroundSupport
import SwiftUI
import UIKit
// iPhone 11 Pro Max - 1
var boo = UILabel()
boo.frame = CGRect(x: 0, y: 0, width: 414, height: 896)
boo.backgroundColor = .white
boo.layer.backgroundColor = UIColor(red: 1, green: 1,blue: 1, alpha: 1).cgColor
boo.layer.cornerRadius = 20
所以我这样做了,但我不知道如何让它显示在预览中,您能帮我吗?我完全是新手,我什么都不知道。我只是复制并粘贴:我的游乐场的屏幕截图
您可以使用预览PlaygroundPage.current.setLiveView()
。这是一个例子。
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
var body: some View {
Text("Hello")
}
}
PlaygroundPage.current.setLiveView(ContentView())
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句