示例工程 32-layout-fundamentals

32-layout-fundamentals/Diagnostics/FrameWidthString.swift

swift · 0.2 KB

// 故意编译失败:frame 的宽高是 CGFloat,不是字符串。
// 复现:swiftc -typecheck Diagnostics/FrameWidthString.swift
import SwiftUI
 
struct Bad: View {
    var body: some View {
        Text("x").frame(width: "100")
    }
}