If anyone has any links to useful information for this i would be very greatful.Apple has the following:https://developer.apple.com/library/archive/documentation/DataManagement/Conceptual/CloudKitQuickStart/FetchingRecords/FetchingRecords.html#//apple_ref/doc/uid/TP40014987-CH4-SW1but quit simply, i dont understand how to put it into action.Kind RegardsAdam
Post
Replies
Boosts
Views
Activity
So that's perfect for the questions that I asked....
I have 10 of these sliders on this page.....
Will I need to declare the options array for each?
Apologies, that's pretty obvious when you look at it.
100% Solved with the info provided
Thanks for this, I will take a look.
What I am finding tricky is that everything keeps changing. Now, for example, there is no app delegate file made when you start a new xplatform app. So I am assuming that I now use the xxxxxxApp.swift file instead.
On Xcode 11 the app delegate was prepopulated with a lot of code and comments, whereas this new file has almost nothing in it.
Thanks all the same, it is appreciated.
Adam
Using this info that has been provided, what do I need to add to the view that should be saving the data to Core Data
Is it still
@Environment(\.managedObjectContext) var moc
When following this, i keep getting the error, cannot find type "MyHumidor" in scope.
My App.swift and the CoreData.swift files below (created the coredata.swift to hold the public class)
import SwiftUI
@main
struct My_HumidorApp: App {
		let context = PersistentCloudKitContainer.persistentContainer.viewContext
		var body: some Scene {
				WindowGroup {
						ContentView().environment(\.managedObjectContext, context)
				}
		}
}
//
//	CoreData.swift
//	My Humidor
//
//	Created by Adam Hewitt on 28/06/2020.
//
import Foundation
import CoreData
public class PersistentCloudKitContainer {
		// MARK: - Define Constants / Variables
		public static var context: NSManagedObjectContext {
				return persistentContainer.viewContext
		}
		// MARK: - Initializer
		private init() {}
		// MARK: - Core Data stack
		public static var persistentContainer: NSPersistentContainer = {
				let container = NSPersistentContainer(name: "My_Humidor")
				container.loadPersistentStores(completionHandler: { (storeDescription, error) in
						if let error = error as NSError? {
								fatalError("Unresolved error \(error), \(error.userInfo)")
						}
				})
				container.viewContext.automaticallyMergesChangesFromParent = true
				container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
				return container
		}()
		// MARK: - Core Data Saving support
		public static func saveContext () {
				let context = persistentContainer.viewContext
				if context.hasChanges {
						do {
								try context.save()
						} catch {
								let nserror = error as NSError
								fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
						}
				}
		}
}
This is the start of my content view:
		import SwiftUI
struct ContentView: View {
		@Environment(\.managedObjectContext) var moc
		@FetchRequest(entitiy: MyHumidors.entity(), sortDescriptors:[]) var humidor: FetchRequest<MyHumidors>
		
		
Any ideas what is causing this from a code perspective?