|
hello! i use a navigationBarButton to request a fetch of the contatcs stored in the device. in general it's working, but when the database is big (like on my real device) it blocks the fetchReuest button (it blocks the whole UI!). at the request i use DisppatchQueue.main.async, but still no improvement. do you have an idea, what i am doing wrong? all my code is still on trial basis, so not all is nicely done yet. thanks in advance for your support and help!
|
|
Hey I know this is a little late but I've recently needed to support the Contacts framework and created a very SwiftUI-friendly API that matches what you find when using Apple's own CoreData APIs. As such, I'm posting this here in case it helps you or others. Its open source so feel free to use in your personal or commercial apps :) Example:
|
|
@shaps80 I am trying to use your framework. I have a TabView and i only want to request access to contacts when tapping on the second tab. However, when I launch the app all i get is a white screen and it never asks me to access contacts unless i kill rhe app. I think it does this because the 2 tab having the @FetchContactList is called when the TabView loads. Not sure on that. How do i only request access when tapping the 2 tab with your framework? Any help would be appreciated. |
|
What you could do is to use tags and a state variable for your Tabs. https://www.hackingwithswift.com/books/ios-swiftui/creating-tabs-with-tabview-and-tabitem Then you could use the onChange modifier for your state and only call the method when Tab 2 is selected. |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.