UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: Ultimate Portfolio App: Edit Project View dismisses itself after every tiny change to data

Forums > Videos

Hey everyone,

I've watched all the videos up to now and when testing the app I've noticed that when I go to the Edit Project View, if I change the title, after typing just one letter the view will dismiss itself. The same issue happens if I change the color as well. It's a weird bug because the Edit Project View and Edit Item View are pretty similar and the Edit Item View works fine.

Has anyone else ran into this bug? If so is this something that will be fixed in a future video?

6      

Firstly it not change in videos up to "Linting our code"

The problem seem to be with update(). I found a work-a-round for time being is to

  1. remove .onChange(update) from both TextFields
  2. remove update() from .onTapGesture in colorButton
  3. add dataController.save() to func update()
  4. change .onDisappear to .onDisappear(perform: update)

This stop the disappear view, however does give a little delay when return before updating that project.

What I have done for time is comment out the changes so I know that they are different to Paul's code and if the bug is fixed or addressed then I will know. whats happening.

7      

Thanks for that! It solved the problem, but I wonder why EditItemView has no issue but for some reason the EditProjectView does?

Hopefully it'll be fixed and explained in a future video.

5      

Anyone find out whats going on here? Been combing through the code thinking i was crazy before I found this post. Buggin me that I can't understand whats causing this behaviour..

5      

@Drzoid101 I've been dealing with this same issue and have been in contact with Paul about this exact issue for months now. There was a point where the Xcode version did not change but the iOS beta version did. If I recall correctly, the issue was fixed with beta 14.3 beta 3, but the reappeared on the next update.

5      

Thanks for the reply! I found the other thread and used @missingnoodle 's fix of adding onEditingChanged: { if !$0 { update() } }) to the textfields. However still getting the same behavior with the Color grid. Tried a few different things but ended up taking update() out of the onTapGesture and adding .onDisappear(perform: update) to the whole view. That fixed it for now but its all a bit messy - get the slight delay on color change, but it's not as bad as the text change having a delay IMO.

5      

Hi guys - i had been experiencing the same issue. I reached out to Paul and he has confirmed this is a bug and he has already reported it to Apple who are looking into this. In the meantime onDisappear() is the best solution.

5      

I have run the code using the latest Xcode Beta - 12.5 build 12E5220o - and found that this bug has been fixed. This is hoping that it remains so.

7      

Hacking with Swift is sponsored by RevenueCat

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.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

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.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.