I get the error "The compiler is unable to type-check this expression in affordable time; attempt breaking apart the expression into distinct sub-expressions" when making an attempt the next code.
I came upon that breaking apart the syntaxes into smaller bits would assist however its nonetheless not working. I additionally tried specifying the info sorts nonetheless the error persists.
This code works if there is just one "if assertion"
ScrollView{
ForEach(discoverManager.discoverResponse, id: .id) { discoverSection in
LazyVStack(alignment: .main){
Textual content(discoverSection.title ?? "").fontWeight(.daring)
ScrollView(.horizontal) {
if let collectionName: String = discoverSection.collectionName, collectionName == "customers", let customers: [ProfileDatas] = discoverSection.customers {
HStack{
ForEach(customers, id: .self){ consumer in
let picture: String = consumer.userProfile?.avatar ?? "default.jpg"
let identify: String = consumer.userProfile?.firstName ?? consumer.username ?? ""
let function: String = consumer.defaultRole ?? ""
let uploadedTime: String = consumer.createdAt ?? ""
DiscoverLargeSlide(imageUrl: picture.createImageURL(), title: identify, uploader: function, uploadedTime: uploadedTime)
.body(width: metrics.dimension.width * 0.8, top: metrics.dimension.top * 0.2)
}
}
}
if let collectionName: String = discoverSection.collectionName, collectionName == "style", let genres: [SubgenreItem] = discoverSection.style {
HStack{
ForEach(genres, id: .self){ style in
let picture: String = style.picture ?? "default.jpg"
let title: String = style.subGenre ?? ""
DiscoverSqaureSlide(imageUrl: picture.createImageURL(), title: title)
.body(width: metrics.dimension.width * 0.8, top: metrics.dimension.top * 0.2)
}
}
}
}
}
.padding(.main, 12.0)
}
Textual content("Hi there")
}