NEW: Learn to build the incredible iOS 15 Weather app today! >>

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?

1      

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.

2      

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.

   

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..

   

@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.

   

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.

   

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.

   

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.

2      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Only until this Sunday, December 12th, you can join a free crash course to learn advanced techniques for testing new and legacy Swift code — it's the fast track to becoming a complete Senior iOS Developer!

Click to learn more

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

Reply to this topic…

You need to create an account or log in to reply.

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.