Skip to content

Instantly share code, notes, and snippets.

@PaulWoodIII
Created August 7, 2019 14:36
Show Gist options
  • Select an option

  • Save PaulWoodIII/5e44fddbb4dd0990f1bd4810a3b0f395 to your computer and use it in GitHub Desktop.

Select an option

Save PaulWoodIII/5e44fddbb4dd0990f1bd4810a3b0f395 to your computer and use it in GitHub Desktop.
Part of a Feedback to apple on what I want from the new FetchRequest struct in SwiftUI
@Environment(\.managedObjectContext) var managedObjectContext
@State var year = "1880"
@State var ascending = true
@State var someValue = "value"
@FetchRequest(
entity: YearOfBirth.entity(),
sortDescriptors: [NSSortDescriptor(key: "year", ascending: ascending.wrappedValue)],
predicate: NSPredicate(format: "%K = %@", “someAttributeKey”, someValue.wrappedValue)
) var years: FetchedResults<YearOfBirth>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment