示例工程 42-swiftdata-persistence

42-swiftdata-persistence/Diagnostics/README.md

markdown · 0.4 KB

# Diagnostics
 
三个文件**故意编译失败**,用来复现第 42 章「报错现场」的真实诊断。
 
```bash
swiftc -typecheck Diagnostics/ModelOnStruct.swift         # error: '@Model' cannot be applied to struct
swiftc -typecheck Diagnostics/ContainerWithoutModel.swift # error: candidate expects 'PersistentModel'
swiftc -typecheck Diagnostics/QueryWithoutModel.swift     # error: does not conform to 'PersistentModel'
```