LiveViewをセットするシュガーシンタックス。
// Code inside modules can be shared between pages and other source files.
import SwiftUI
import PlaygroundSupport
public func show<incomingview>(_ newLiveView: IncomingView, wantsFullScreen: Bool=true) where IncomingView : View {
#if os(iOS)
PlaygroundPage.current.wantsFullScreenLiveView = wantsFullScreen
#endif
PlaygroundPage.current.setLiveView(newLiveView)
}
使い方
import SwiftUI
struct ContentView: View {
var body: some View {
Text("SwiftUI")
}
}
show(ContentView(), wantsFullScreen:false)
0 件のコメント:
コメントを投稿