struct ChildView: View {
// var count = 0 // OK
private var count = 0 // 'ParentView' initializer is inaccessible due to 'private' protection level
var body: some View {
試してみる。
struct ChildView: View {
// public var count = 0 // OK
// internal var count = 0 // OK
// private var count = 0 // NG
// @State var count = 0 // OK
// @State public var count = 0 // OK
// @State internal var count = 0 // OK
// @State private var count = 0 // OK
var body: some View {
😩 Editor → Canvas → Automatically Refresh Canvas OFF
You can turn off the auto-compile feature for previews/canvas'. When having a SwiftUI View open in the editor go to the Editor -> Canvas -> Automatically Refresh Canvas.