You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
605 B
26 lines
605 B
2 years ago
|
//
|
||
|
// 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")
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|