Your Second iOS and SwiftUI App · Challenge: Prioritize Tasks |

This is a companion discussion topic for the original entry at

Hi @jessycatterwaul,
Thanks for the great tutorial!

I am running into an issue and was wondering if you would be able to help me out.
In the “Adding and deleting tasks”, we dismiss the modal using


However, when the modal dismisses, clicking on the “plus” button is not bringing the modal back up. When I added a breakpoint in the “action” method, that breakpoint is not getting hit. Removing out the code to dismiss the modal and just dismissing the modal by swiping down allows me to bring up that modal again.

I tried googling to see if it is a common issue but couldn’t find it.
Any help with this would be greatly appreciated!

1 Like

Did you try to define prioritizedTasks outside of TaskStore? If so, that error is expected.

Students have come across this bug while working in various episodes. I reported it to Apple in October but haven’t heard back about it. Hopefully we’ll see it fixed before WWDC this year.

ok, that sounds good!
Thanks for the quick response!

1 Like

While going through the “Binding” part of the “Editing tasks”, I am running into another issue. I made all the code changes and when I edited a task and hit the back button, I get the following warning in the console -

TaskList[8144:368975] [TableView] Warning once only: UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. Make a symbolic breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy to catch this in the debugger and see what caused this to occur, so you can avoid this action altogether if possible, or defer it until the table view has been added to a window. Table view: <TtC7SwiftUIP33_BFB370BA5F1BADDC9D83021565761A4925UpdateCoalescingTableView: 0x7fbb848fc000; baseClass = UITableView; frame = (0 0; 414 896); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x6000026d08a0>; layer = <CALayer: 0x600002803880>; contentOffset: {0, -140}; contentSize: {414, 116.66666666666667}; adjustedContentInset: {140, 0, 34, 0}; dataSource: <TtGC7SwiftUIP10$109feca4419ListCoreCoordinatorGVS_20SystemListDataSourceOs5Never_GOS_19SelectionManagerBoxS2_: 0x7fbb83730ea0>>

I don’t understand why it thinks the UITableView (I am guessing it is referring to the content view?) is not in the view hierarchy. Is it because the TaskEditView is visible and so the content view is not visible?
Any idea/help on why this is happening?

At least for the time being, SwiftUI is relying on UITableView to provide implementation for List.

People seem to be having success dealing with the problem with UIKit, but I don’t see a fix for SwiftUI yet.

I see!
thanks for the response @jessycatterwaul

1 Like

Challenge: Just create @Published Array.
Solution: Let create extensions, launch rocket to the moon and save humanity from cancer…


is this a good alternative solution:

@Published var prioritizedTasks = [PrioritizedTasks(priority: .no, tasks: [Task(name: “walk dog”),
Task(name: “do homework”),
Task(name: “vaccumn”)]),
PrioritizedTasks(priority: .low, tasks: [Task(name: “mow lawn”),
Task(name: “do laundry”),
Task(name: “clean bathroom”)]),
PrioritizedTasks(priority: .medium, tasks: [Task(name: “work out”),
Task(name: “get groceries”)]),
PrioritizedTasks(priority: .high, tasks: [Task(name: “finish documentary”), (Task(name: “clean room”))])]

It’s fine, just harder to read in-place.

I feel like I am trying to learn to drive and the driving instructor is more interested in showing me his latest, self-made car that has lots of bells and whistles but it doesn’t really work. I am not quite sure if the choice of the car was best-suited for learning to drive. Why don’t you make the same app in UIKit? Watching two courses with Ray, gave me an impression that all the other courses will logically build up step by step. Unfortunately this course is like thousands of others on line where someone enthusiasts spend hours to “figure out” how to do it in Swift UI and now are sharing their findings with the rest of the world.

Also, why use complicated jargon that hasn’t been explained ( like “member-wise” initialiser, etc. )? Is anyone proof-reading the content of this course?


I agree for the most part - but I did want to give credit that this approach is where I finally got my “lightbulb moment” on extensions & custom initializers for my own classes. Adding an extension to accept task names as String and realizing that new init() just augments the stock “memberwise” initializer (without replacing it) helped me understand how this pattern can work for me.

But to be fair, this wasn’t really explained in the video, only demonstrated.


@bobiq11 bendrexl Thank you for your feedback - much appreciated!

I was not able to even begin to attempt this challenge.

I tried your project version and the code doesn’t work. No Priority groupings.