示例工程 30-swiftui-mental-model

30-swiftui-mental-model/Diagnostics/README.md

markdown · 0.4 KB

# Diagnostics
 
三个文件**故意编译失败**,用来复现第 30 章「报错现场」的真实诊断。
 
```bash
swiftc -typecheck Diagnostics/MutateSelfInBody.swift  # error: left side of mutating operator isn't mutable
swiftc -typecheck Diagnostics/TernaryMismatch.swift   # error: result values in '? :' have mismatching types
swiftc -typecheck Diagnostics/AnyViewStorage.swift    # error: type 'any View' cannot conform to 'View'
```