//
//  SimpleListOfThingsView.swift
//  JustOneThingWatch
//
//  Created by Alan Francis on 10/07/2023.
//

import SwiftUI
import CoreData

struct SimpleListOfThingsView: View {
    @Environment(\.managedObjectContext) private var viewContext
    @FetchRequest(
        sortDescriptors: [NSSortDescriptor(keyPath: \PersistentThing.createdAt, ascending: true)],
        animation: .default)
    private var items: FetchedResults<PersistentThing>
    
    var body: some View {
        List {
            ForEach(items) { item in
                Text(item.text ?? "no text")
            }
        }
    }
}
