'Font' 在 SwiftUI 教程中不可转换为 'Font?'

'Font' is not convertible to 'Font?' in SwiftUI Tutorial

在 Apple SwiftUI 教程中,我刚遇到一些错误。

https://developer.apple.com/tutorials/swiftui/building-lists-and-navigation

在本教程中,在第 8、9、10 步之后,出现错误。

这是我写的:

import SwiftUI

struct LandmarkDetail : View {

var landmark: Landmark

var body: some View {
    VStack {

        MapView(landmark.locationCoordinate)
            .edgesIgnoringSafeArea(.top)
            .frame(height: 300)


        CircleImage(landmark.image(forSize: 50)).offset(y: -130)
        .padding(.bottom, -130)

        VStack(alignment: .leading){
            Text(landmark.name)
                .font(.title)

            HStack{
                Text(landmark.park)
                    .font(.subheadline)
                Spacer()
                Text(landmark.state)
                    .font(.subheadline)
            }
        }
        .padding(30)

        Spacer()
        }
}

这段代码运行良好,没有任何错误。

但是把一些常量改成变量后,就出现了这些错误。

我曾多次尝试重启 Xcode,但都没有用。

怎么了?

下面是苹果写的:

var body: some View {
    VStack {
        MapView(coordinate: landmark.locationCoordinate)
            .frame(height: 300)

        CircleImage(image: landmark.image(forSize: 250))
            .offset(y: -130)
            .padding(.bottom, -130)

        VStack(alignment: .leading) {
            Text(landmark.name)
                .font(.title)

            HStack(alignment: .top) {
                Text(landmark.park)
                    .font(.subheadline)
                Spacer()
                Text(landmark.state)
                    .font(.subheadline)
            }
        }
        .padding()

        Spacer()
    }

Xcode:版本 11.0 测试版 (11M336w)

改变这两行,

        MapView(landmark.locationCoordinate)
            .edgesIgnoringSafeArea(.top)
            .frame(height: 300)

        CircleImage(landmark.image(forSize: 50)).offset(y: -130)
        .padding(.bottom, -130)

对此,

        MapView(coordinate: landmark.locationCoordinate)
                .edgesIgnoringSafeArea(.top)
                .frame(height: 300)

        CircleImage(image: landmark.image(forSize: 50)).offset(y: -130)
                .padding(.bottom, -130)