This is what I have in code:
struct ServicesView: View {
@FetchRequest(entity: Category.entity(), sortDescriptors: [NSSortDescriptor(keyPath: \Category.name, ascending: false)], animation: .easeIn) var results: FetchedResults<Category>
var body: some View {
List(results) { category in
VStack(alignment: .leading, spacing: 3, content: {
Text(category.name)
.font(.system(size: 12))
.foregroundColor(.white)
Text("x\(category.services.count)")
})
}
.overlay(
Text(results.isEmpty ? "Nothing here" : "")
)
.onAppear {
print("