WidgetKit Watch Complication not displaying Images

My complication code is very similar to that found in the Migrating ClockKit complications to WidgetKit tutorial. Except, I am only interested in displaying the app icon as the complication.

I just cannot get any 'custom' images to display in the simulator, nor on a Watch. Image(systemImage: "") work fine, however.

Does the image need to be re-sized to a specific resolution? The original image is 1024×1024, I have tried re-sizing this down to multiple smaller resolutions with no success.

import WidgetKit
import SwiftUI
import Intents

struct Provider: IntentTimelineProvider {
    func placeholder(in context: Context) -> SimpleEntry {
        SimpleEntry(date: Date(), configuration: ConfigurationIntent())
    }

    func getSnapshot(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (SimpleEntry) -> ()) {
        let entry = SimpleEntry(date: Date(), configuration: configuration)
        completion(entry)
    }

    func getTimeline(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
        var entries: [SimpleEntry] = []

        // Generate a timeline consisting of five entries an hour apart, starting from the current date.
        let currentDate = Date()
        for hourOffset in 0 ..< 5 {
            let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)!
            let entry = SimpleEntry(date: entryDate, configuration: configuration)
            entries.append(entry)
        }

        let timeline = Timeline(entries: entries, policy: .atEnd)
        completion(timeline)
    }

    func recommendations() -> [IntentRecommendation<ConfigurationIntent>] {
        return [
            IntentRecommendation(intent: ConfigurationIntent(), description: "Treadmill Assistant")
        ]
    }
}

struct SimpleEntry: TimelineEntry {
    let date: Date
    let configuration: ConfigurationIntent
}

struct Tread_Cadence_ComplicationEntryView : View {
    
    var entry: Provider.Entry

    var body: some View {
            Image("AppIcon")
            //.resizable()
            //.frame(width: 50, height: 50)
            //.scaledToFill()
    }
}

@main
struct Tread_Cadence_Complication: Widget {
    let kind: String = "Tread_Cadence_Complication"

    var body: some WidgetConfiguration {
        IntentConfiguration(kind: kind, intent: ConfigurationIntent.self, provider: Provider()) { entry in
            Tread_Cadence_ComplicationEntryView(entry: entry)
        }
        .configurationDisplayName("Treadmill Assistant")
        .description("Opens Treadmill Assistant.")
    }
}

struct Tread_Cadence_Complication_Previews: PreviewProvider {
    static var previews: some View {
        Tread_Cadence_ComplicationEntryView(entry: SimpleEntry(date: Date(), configuration: ConfigurationIntent()))
            .previewContext(WidgetPreviewContext(family: .accessoryRectangular))
    }
}

Answered by Will0912 in 732450022

Fixed, I was using an 'AppIcon' asset instead of an 'image' asset -_-

Accepted Answer

Fixed, I was using an 'AppIcon' asset instead of an 'image' asset -_-

I hope you aren't using a 1024px image and getting SwiftUI to scale it down by setting .frame(width: 50, height: 50)? That uses far more memory than necessary. Scale down the image somewhere else, save it to your assets, and use that in the complication.

WidgetKit Watch Complication not displaying Images
 
 
Q