Post

Replies

Boosts

Views

Activity

Reply to How to remove duplicate objects from CoreData in Swift?
Actually the above will wipe all of your records because it doesn't select the winning objectID out of the collection of multiple results. Any good database design begins with data normalization, unique keys etc ...: Take a look at the following code by apple on how to dedupe core data records: https://developer.apple.com/documentation/coredata/synchronizing_a_local_store_to_the_cloud see CoreDataStack class
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’22
Reply to Cloudkit - Coredata and multiples database
You need to associate the test & prod with its own container id. Add them via Xcode iCloud capabilities containers list. let testContainerID = NSPersistentCloudKitContainerOptions(containerIdentifier:"your_bundle_id.test") let prodContainerID = NSPersistentCloudKitContainerOptions(containerIdentifier:"your_bundle_id.prod") Assign each container ID to the respective data store
Topic: App & System Services SubTopic: iCloud Tags:
Jan ’22
Reply to Transfer data on return
Read here swift guide on closures. class VCText: UIViewController { ... var completionHandler: (([addCatogrey])->Void)? ... @IBAction func doneBtnClicke(_ sender: Any) { ... /// return a copy of the array no need to create the object already added to the array a second time as done in your code using the delegate protocol pattern completionHandler?(arrS1) } } In view controller A ... let vc = self.storyboard?.instantiateViewController(withIdentifier: "VCText") as! VCText vc.delgateText = self // get rid of this /// define body of completion handler here vc.completionHandler = { array in /// do something with the array in view controller A } ...
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’22
Reply to Simulator stuck on white screen? (Django + Xcode)
This is most likely failing because you're ignoring failures on a non ssl http endpoint: read here if let response = try? JSONDecoder().decode([Account].self, from: data) {    DispatchQueue.main.async {              self.accounts = response     } } else { // add logic to handle api errors here }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22
Reply to How to have the square (logo only) Apple sign in button.
Button(action: {}) {                 ZStack {                     RoundedRectangle(cornerRadius: 16)                         .fill(.gray)                     Image(systemName: "applelogo")                         .resizable()                         .padding(2.0)                 }             }             .frame(width: 120.0, height: 120.0)
Topic: App & System Services SubTopic: General Tags:
Jan ’22
Reply to Socket - web server problems
Who wrote the webserver? What compiler tools did you use to write the webserver? Who is sending the packets to the clients? Is your handcrafted webserver following all of the RFC-based specs? Was the webserver written with Xcode, does it run on the mac or any Apple mobile products? In this scenario, your web server is sending data in response to a client, not the other way around other than a get URL request.
Topic: App & System Services SubTopic: General Tags:
Jan ’22
Reply to Separating CoreData functionality from the View (SwiftUI) but Still with observability
@DelawareMathGuy this is what I had to do to trigger the FRCDelegate but this goes against the FRC automatically doing it after the performFetch fetchedResultsController?                 .publisher(for: \.fetchedObjects)                 .receive(on: OperationQueue.main)                 .sink(receiveValue: { [weak self] data in                     guard let self = self,                             let data = data else { return }                     for (index, object) in data.enumerated() {                         let indexpath = IndexPath(item: index, section: 0)                         if let controller = self.fetchedResultsController as? NSFetchedResultsController<NSFetchRequestResult> {                             self.controller(controller, didChange: object,                                             at: nil,                                             for: .insert,                                             newIndexPath: indexpath)                         }                     }                 }).store(in: &cancellables)
Topic: App & System Services SubTopic: iCloud Tags:
Jan ’22
Reply to How to remove duplicate objects from CoreData in Swift?
Actually the above will wipe all of your records because it doesn't select the winning objectID out of the collection of multiple results. Any good database design begins with data normalization, unique keys etc ...: Take a look at the following code by apple on how to dedupe core data records: https://developer.apple.com/documentation/coredata/synchronizing_a_local_store_to_the_cloud see CoreDataStack class
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Cloudkit - Coredata and multiples database
You need to associate the test & prod with its own container id. Add them via Xcode iCloud capabilities containers list. let testContainerID = NSPersistentCloudKitContainerOptions(containerIdentifier:"your_bundle_id.test") let prodContainerID = NSPersistentCloudKitContainerOptions(containerIdentifier:"your_bundle_id.prod") Assign each container ID to the respective data store
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Transfer data on return
Read here swift guide on closures. class VCText: UIViewController { ... var completionHandler: (([addCatogrey])->Void)? ... @IBAction func doneBtnClicke(_ sender: Any) { ... /// return a copy of the array no need to create the object already added to the array a second time as done in your code using the delegate protocol pattern completionHandler?(arrS1) } } In view controller A ... let vc = self.storyboard?.instantiateViewController(withIdentifier: "VCText") as! VCText vc.delgateText = self // get rid of this /// define body of completion handler here vc.completionHandler = { array in /// do something with the array in view controller A } ...
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Simulator stuck on white screen? (Django + Xcode)
This is most likely failing because you're ignoring failures on a non ssl http endpoint: read here if let response = try? JSONDecoder().decode([Account].self, from: data) {    DispatchQueue.main.async {              self.accounts = response     } } else { // add logic to handle api errors here }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to How to have the square (logo only) Apple sign in button.
Button(action: {}) {                 ZStack {                     RoundedRectangle(cornerRadius: 16)                         .fill(.gray)                     Image(systemName: "applelogo")                         .resizable()                         .padding(2.0)                 }             }             .frame(width: 120.0, height: 120.0)
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Socket - web server problems
Who wrote the webserver? What compiler tools did you use to write the webserver? Who is sending the packets to the clients? Is your handcrafted webserver following all of the RFC-based specs? Was the webserver written with Xcode, does it run on the mac or any Apple mobile products? In this scenario, your web server is sending data in response to a client, not the other way around other than a get URL request.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Separating CoreData functionality from the View (SwiftUI) but Still with observability
@DelawareMathGuy this is what I had to do to trigger the FRCDelegate but this goes against the FRC automatically doing it after the performFetch fetchedResultsController?                 .publisher(for: \.fetchedObjects)                 .receive(on: OperationQueue.main)                 .sink(receiveValue: { [weak self] data in                     guard let self = self,                             let data = data else { return }                     for (index, object) in data.enumerated() {                         let indexpath = IndexPath(item: index, section: 0)                         if let controller = self.fetchedResultsController as? NSFetchedResultsController<NSFetchRequestResult> {                             self.controller(controller, didChange: object,                                             at: nil,                                             for: .insert,                                             newIndexPath: indexpath)                         }                     }                 }).store(in: &cancellables)
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Jan ’22