Post

Replies

Boosts

Views

Activity

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 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
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:
Jan ’22
Reply to Apple Sign In Button does not work properly
The following and your code above works perfectly fine on a real device, not the simulator:         VStack {             SignInWithAppleButton(.continue) { request in                 request.requestedScopes = [.email, .fullName]             } onCompletion: { result in                 switch result {                 case .success(let auth):                     guard let credential = auth.credential as? ASAuthorizationAppleIDCredential,                     let email = credential.email else { return }                     print("\(email)")                 case .failure(let error):                     print(error.localizedDescription)                 }             }         }.frame(width: 80, height: 28, alignment: .center)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22
Reply to App Store Review Guidelines 5.1.1 (ix) - Account delete requirement for banking apps
Someone in Apple certainly doesn’t understand how banking institutions function! I think there should be push back on this from banks because any solution is going result is a call to a call center that is going to go no where when someone has a mortgage, and other owed balances and this nonsense of giving the customer the illusion they can just delete their account was not planned out properly by Apple.
Topic: Privacy & Security SubTopic: General Tags:
Jan ’22
Reply to iPhone Orientation Impacting Tab View within a Navigation View
This is the order. The NavigationView encapsulates each Primary view of the tab view item. The TabView encapsulates all of the NavigationViews TabView {                 NavigationView { TabAView()                 }                 .tabItem {                     Label {                         Label("Tab A", systemImage: "house.circle.fill")                     } icon: {                         Image(systemName: "clock")                     }                 }                 .tag(Tabs.taba)                 NavigationView { TabBView()                 }                 .tabItem {                     Label {                         Label("Tab B", systemImage: "house.circle.fill")                     } icon: {                         Image(systemName: "clock")                     }                 }                 .tag(Tabs.tabb) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22