Swift .font不能转换为.font

Swift .font不能转换为.font,swift,swiftui,Swift,Swiftui,我正在学习Swift UI教程,我遇到了这个错误,而讲师没有。.font错误在第一次Vstack中仅出现1次,而第二次没有问题 import SwiftUI struct ContentView : View { @State var title: String = "" @State var rating = 3.0 @State var seen = false var body: some View { List {

我正在学习Swift UI教程,我遇到了这个错误,而讲师没有。.font错误在第一次Vstack中仅出现1次,而第二次没有问题

import SwiftUI

struct ContentView : View {
    @State var title: String = ""
    @State var rating = 3.0
    @State var seen = false

    var body: some View {
        List {
            Section {
                VStack(alignment: .leading) {
                    Text("Title")
                    .font(.subheadline)       
                    .foregroundColor(.grey)
                TextField($title)
                }
            }
            Section {
                VStack(alignment: .leading) {
                    Text("Rating").font(.subheadline)
                    .foregroundColor(.gray)
                    HStack {
                        Spacer()
                    Text(String(repeating:"*", count:Int(rating)))
                Slider(value: $rating, from: 1.0, through: 5.0, by: 
        1.0).font(.title)
                        .foregroundColor(.yellow)
                    Spacer()
                    }
                }
            }

         }.listStyle(.grouped)
       }
    }

#if DEBUG
struct ContentView_Previews : PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
#endif

这是一个误导性的错误。这个问题与
Font
没有任何关系。问题是您有一个打字错误:

Text("Title")
    .font(.subheadline)       
    .foregroundColor(.grey)

foregroundColor
应该是
.gray
而不是
.gray

我不清楚你的实际问题是什么。你在找人帮忙修理东西吗?您只是想了解错误发生的原因吗?欢迎使用堆栈溢出。虽然我和其他人一样对一个问题感到内疚,但事实并非如此。打字错误并不是任何人都会期望你犯的错误。作为一名新撰稿人,您首先要了解两件事—(1)您正在处理一个极端的测试版产品,我们大多数人(所有人?)都已经意识到,在这一点上,一些错误菜单是非常误导人的。(2) 另一个新的捐款人可能有答案。。。请不要忘记,您正在使用测试版产品。
Text("Title")
    .font(.subheadline)       
    .foregroundColor(.grey)