var nsPredicate : NSPredicate?
var sortDescriptors : [SortDescriptor <Result>]
Result
inherits NSManagedObject
.
Result
がNSManagedObject
を継承する場合に利用可能です。
var nsSortDescriptors : [NSSortDescriptor ]
Availability 有効性
Technology
struct FetchedResults<Result> where Result : NSFetchRequestResult
Use a Fetched
instance to show or edit Core Data managed objects in your app’s user interface. You request a particular set of results by specifying a Result
type as the entity type, and annotating the fetched results property declaration with a Fetch
property wrapper. For example, you can create a request to list all Quake
managed objects that the Loading and Displaying a Large Data Feed sample code project defines to store earthquake data, sorted by their time
property:
SortDescriptor(\.time, order: .reverse)]) (sortDescriptors: [
private var quakes: FetchedResults<Quake>
The results instance conforms to Random
, so you access it like any other collection. For example, you can create a List
that iterates over all the results:
List(quakes) { quake in
NavigationLink(destination: QuakeDetail(quake: quake)) {
QuakeRow(quake: quake)
}
}
When you need to dynamically change the request’s predicate or sort descriptors, set the result instance’s ns
and sort
or ns
properties, respectively.
The fetch request and its results use the managed object context stored in the environment, which you can access using the managed
environment value. To support user interface activity, you typically rely on the view
property of a shared NSPersistent
instance. For example, you can set a context on your top level content view using a container that you define as part of your model:
ContentView()
.environment(
\.managedObjectContext,
QuakesProvider.shared.container.viewContext)
var nsPredicate : NSPredicate?
var sortDescriptors : [SortDescriptor <Result>]
Result
inherits NSManagedObject
.
Result
がNSManagedObject
を継承する場合に利用可能です。
var nsSortDescriptors : [NSSortDescriptor ]
var startIndex : Int
var endIndex : Int
subscript(Int) -> Result
typealias Element
typealias Index
typealias Indices
typealias Iterator
typealias SubSequence
struct FetchRequest
struct SectionedFetchRequest
struct SectionedFetchResults