I found sometimes my Image render right,but Text render the old data.
My Image use downloaded image data,and Text use model data,I always found image can't match text name,the image is new real data,but the text name is last data.
My widget timeline
How to fix it?
What's the reason?
show my code:
My Image use downloaded image data,and Text use model data,I always found image can't match text name,the image is new real data,but the text name is last data.
My widget timeline
Code Block Swift let entryDate = Calendar.current.date(byAdding: .minute, value: 10, to: Date())! let entry = SimpleEntry(date: Date(), liveData: data) let timeline = Timeline(entries: [entry], policy: .after(entryDate))
How to fix it?
What's the reason?
show my code:
Code Block SwiftUI var body: some View { HStack(spacing: 0) { let avatarImage = LiveWidgetImageLoader.loadDownloadedImage(url: roomItem.avatar, placeholder: "live_bigAvatar_placeholder") avatarImage .resizable() .frame(width: avatarSize, height: avatarSize) .aspectRatio(contentMode: .fit) .background(Color("live_avatar_bgColor")) .clipShape(RoundedRectangle(cornerRadius: 10)) if roomItem.userName.count != 0 { VStack(alignment: .leading, spacing: 4) { Text(roomItem.userName) .font( Font.system(size: 13) .weight(.medium) ) .lineLimit(1) .foregroundColor(Color("live_blackColor")) Image("living_tagIcon") } .padding(.leading, 6) } Spacer.min() } } }