示例工程 35-state-and-data-flow

35-state-and-data-flow/Diagnostics/BindableOnValue.swift

swift · 0.2 KB

// 故意编译失败:@Bindable 只能包装 Observable 对象。
// 复现:swiftc -typecheck Diagnostics/BindableOnValue.swift
import SwiftUI
 
struct Bad: View {
    @Bindable var value: Int
    var body: some View { Text("\(value)") }
}