Hi,
Well done... you are way above what am..
Being a simple motorcycle mechanic, I do not have an IT background.
That code you gave me is way above what I can do. I would not know how to implement it.
I was hoping to simply use similar code that is on the IOS App and duplicate it on the Watch App.
For example, my IOS code.
import UIKit
import CloudKit
class ListViewController: UIViewController {
// Setup Database from iCloud
let database = CKContainer.default().privateCloudDatabase
var records = [CKRecord]()
then....
// Get Database from iCloud
@objc func queryDatabase() {
let query = CKQuery(recordType: "FuelBuddy", predicate: NSPredicate(value: true))
database.perform(query, inZoneWith: nil) { (records, error) in
let sortedRecords = records!.sorted(by: { $0.creationDate! > $1.creationDate! })
self.records = sortedRecords
DispatchQueue.main.async {
// Check and report if an error
if error != nil {
self.alert()
} else {
//self.records = records!
self.tableView.reloadData()
self.tableView.refreshControl?.endRefreshing()
}}}}}
But as soon as I add this code to the Watch App, it crashes.
// Setup Database from iCloud
let database = CKContainer.default().privateCloudDatabase
var records = [CKRecord]()
Man I am lost..
Jusyt cannot find any samples.
Cheers.
Craig.