0

On the beta 3 of Xcode 11 the canvas view doesn't work I always have this message "TestPremier.app crashed: communication with the app was interrupted". But in the ContentView.swift I don't have this problem.

I have already tried to create a new app with Swift UI, I already too "Clean Build Folder" or restart my Mac which is running Mac OS 10.15 beta 3.

//
//  LongArticleItem.swift
//  TestPremier
//
//  Created by Mathieu Cloart on 13/07/2019.
//  Copyright © 2019 Mathieu Cloart. All rights reserved.
//

import SwiftUI

struct LongArticleItem : View {

var article_data_loading:Article_data_loading

var body: some View {
    VStack(alignment: .leading, spacing: 16.0) {
        Image(article_data_loading.imageName)
            .resizable()
            .renderingMode(.original)
            .aspectRatio(contentMode: .fill)
            .frame(width: 300, height: 170)
            .cornerRadius(10)
            .shadow(radius: 10)

        VStack(alignment: .leading, spacing: 5.0) {
            Text(article_data_loading.name)
                .color(.primary)
                .font(.headline)
            Text(article_data_loading.description)
                .font(.subheadline)
                .color(.secondary)
                .multilineTextAlignment(.leading)
                .lineLimit(4)
                .frame(height: 80)
        }

        .frame(width: 330)
    }
   }
}

#if DEBUG
struct LongArticleItem_Previews : PreviewProvider {
static var previews: some View {
    LongArticleItem(article_data_loading: articleData[0])
}
}
#endif

I expect to see the result of this in the canvas view but actully I don't even if my build succed

Mathieu Cloart
  • 121
  • 2
  • 11

1 Answers1

0

It shows in preview if I comment out this part:

Image(article_data_loading.imageName)
        .resizable()
        .renderingMode(.original)
        .aspectRatio(contentMode: .fill)
        .frame(width: 300, height: 170)
        .cornerRadius(10)
        .shadow(radius: 10)

My guess is that it cannot load an image named by article_data_loading.imageName because it can't find it in the bundle. What does article_data_loading.imageName represent?