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?


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.


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.


Hacking with Swift is sponsored by Superwall

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn More

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.