|
Hi All! I noticed something in project 17 (Flashzilla) that I was 1. wondering if anyone else noticed and 2. can't figure out a solution to. In this project, there's an EditCards view that appears when the Plus button in ContentView is pressed. This is the screen where you can add and delete individual index cards to and from the array of index cards that you're working with. Deleting cards works as expected if you use swipe to delete and immediately press the delete button, but if you swipe to reveal the delete button and don't immediately press it then the delete button disappears in about half a second. The same goes for if you use an EditButton. In other words, it feels pretty glitchy and not user friendly. I downloaded and ran Paul's code for this project, and this issue is also present in his code, so it seems like a bug he may have missed before putting the project together. Here's my code for the EditCards view:
My Card type:
|
|
I replaced this line in your code above:
I also commented out the calls to DataManager.save()
Then I ran your code in the simulator. Works fine! Swipe to delete will delete the fake row with a full swipe. A partial swipe shows the delete button. But it stays put and doesn't exhibit the behavior you mention. So, if this debugging session provides you with any comfort, it's that the
Let us know what you find! |
|
Thanks a lot for the response! Like you suggested, I tried making EditCards to be the main view that appears within the FlashCardApp file and it worked! However, I also tried commenting out the call to the DataManager.save() method and adding in a Dummy array of cards like you suggested without adding EditCards to the FlashCardApp file and then the issue still persisted. In other words, it seems I don't have to follow all of your suggestions to solve the problem, I only need to change up the FlashCardApp app file in the way that you described. Would you mind explaining why this works? I'm glad this solution solves the problem, but it doesn't seem like a very ideal fix, especially since it means I don't get any control over the view that's shown when the app starts up. I just don't understand how changing the order in which a view presents itself could affect whether or not deleting rows within that view works properly. I'm guessing there's more at play here than just changing the order that the view shows up, but regardless it seems quite strange. |
|
It is due to the timer being published after saving a set of cards, even when in the edit mode, and interferring with the Using Paul's solution as the baseline. in ContentView change the timer definition to be
Add this function above the
Change the operation for the add button to be
Add the following lines to the end of resetCards()
|
|
I wasn't really trying to solve your problem. I was just isolating a portion of your solution and testing that one piece. Since I didn't have access to your data, or your JSON loading code, I didn't have the Additionally, since I didn't have the I isolated the If you eliminate EditCard as the source of your interface issues, then you'll need to look for the problem in other views. Update:@greenamber found the issue in another part of your code. I was just sharing a technique for isolating and testing the view where you thought you had the problem. |
|
@Obelix That makes a lot of sense! I hadn't thought to troubleshoot that way (still pretty new here!) so it really didn't occur to me that that's what you were trying to get me to do, sorry for the confusion there! @Greenamberred Thanks a lot for taking the time! I'm gonna give this a shot |
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.