Widget background Image not loading IOS 17 Xcode

My widget will not load on my simulator or devices with IO7 17.2 I am getting preview error "Widget needs to adopt containerBackground".

The background image is called "bg" and code is below, how do I fix this issue?

var body: some View {
        ZStack{
            Image("bg")
                .resizable()
                .aspectRatio(contentMode: .fill)
            VStack{
                Text(entry.namazName)
                    .foregroundColor(Color.white)
                    .font(.custom("HelveticaNeue-Medium", size: 24))
                Spacer()
                    .frame(height: 8)
                Text("B: " + entry.startTime)
                    .foregroundColor(Color.white)
                    .font(.custom("HelveticaNeue-Medium", size: 22))
                Text("J: " + entry.jamatTime)
                    .foregroundColor(Color.white)
                    .font(.custom("HelveticaNeue-Medium", size: 22))

            }
        }
    }

Here's a sample implementation of containerBackground. LMEntryView is your widget view.

struct LMWidget: Widget {

    var supportedFamilies: [WidgetFamily] {
        [.systemSmall,
         .systemMedium]
    }

    var body: some WidgetConfiguration {
        StaticConfiguration(kind: "LMWidget",
                            provider: LMTimelineProvider()) { entry in
            if #available(iOS 17, *) {
                LMEntryView(entry: entry)
                    .frame(maxWidth: .infinity, maxHeight: .infinity)
                    .containerBackground(Color("WidgetBackground"), for: .widget)
            } else {
                LMEntryView(entry: entry)
                    .frame(maxWidth: .infinity, maxHeight: .infinity)
                    .background(Color("WidgetBackground"))
            }
        }
        .configurationDisplayName("L_M_Widget_Title".localized)
        .description("L_M_Widget_Description".localized)
        .supportedFamilies(supportedFamilies)
        .contentMarginsDisabled()
    }
}

Thank you for your reply, I tried the above code and it still doesn't work, I am having the same issue, I am getting the error below and widget is not loading.

The widget is only showing this below:

Any advise or help with this, still can't get it working.

Widget background Image not loading IOS 17 Xcode
 
 
Q