Relative Content

Tag Archive for iosxcodeswiftui

How to update the uiview with the progress of class method

I have a UIView with a list of items. When one item is deleted from the list an overall variable will be recalculated in the model class, which will take some time as it will go over all data on all the items. In order to keep in touch with the user I like to show a progress bar, but for that I need the percentage done from the class to the UIView. I was not able to find out how to get the percentage during the recalculation. I would be very happy if one could point me to the right direction:

Text field in SwiftUI iOS app hangs/lags, why?

I’m creating a dictionary application as a personal project. I’m loading in a text file with 70,000 lines of strings (about 2MB). When typing in the keyboard, the key strokes hang, creating a frustrating lag for UX (can type like one character per second max). I’d like to know why. I’ve been debugging this application for the last week. At first, I thought it was the filtering operations when the user searches for text that was slowing everything down. So I created the TextField with debounce logic, to limit the number of times the filtering would happen (e.g. if I user typed keys with less than 800 miliseconds it wouldn’t filter on each individual keystroke, saving time of looping over the entire dictionary unnecessarily until the user paused for 800ms). Shockingly to me, this did not help. I could see that the filtering would execute only after 800 seconds, but the text field was still lagging when typing. I then put all that filtering logic into a Dispatch Queue to run on a secondary thread. That didn’t help. I then removed the filtering operations entirely, and the keyboard lag still persists!

SwiftUI use .presentationSizing

With iOS 18 beta which recently came out, I was curious in how to use the new .presentationSizing. Does it completely change the size of the sheet or is this only a notable feature for mac apps? Also are there any new features which make it so the .sheet can be presented above the tab bar like in the apple FindMy app.

Why does my app always prompt the same quote?

I’m a newbie Xcode enthusiast, trying to create an iOS application in Xcode where on the “Et moi” button, random quotes are prompted.
My problem is that despite having created tables for the different quotes to be generated randomly, it doesn’t work.

SwiftUI app View not filling the entire iPhone screen

Adding iPhone (iOS SDK) as Supported Destination to a SwiftUI app in Xcode initially created for macOS, the content of the app view will not extend to the whole screen as it usually happens when you create a SwiftUI app with iPhone (iOS) as destination from the beginning.

Does coreData have more than one empty state?

I am creating a workout app using CoreData, where it gives you a workout to do. Within each workout you are given 4 sets to do, the sets are buttons, and you are able to track how many sets/reps you did. Once you enter how many sets/reps you did, the button will change from “Set: 1” how set it supposed to look like to “# of reps x # of weight”. I was able to figure out this code and able to save it to CoreData, this issue i’m having is allowing each button to have their own set. When ever I update one set/button, it syncs across all buttons. I would like each button to have their own set/connection to coreData, but im not sure how to do that. I have attached pictures to show the before and after between when coreData is empty vs when it’s not. Set with all buttons sync across (dont want that)