|
Hello everyone! I added a title for each of my sections. But when a section is empty, the tittle doesn't disappear. Here is my code.
|
|
TooMas asks:
You pasted an awful lot of code, but much of it has nothing to do with your question. At times like this, it might be useful to Step Away from your Project! Instead, concentrate on the function you want with a small project. This is a great job for Experiment with options! Please return and let us know how you solved this!
|
|
Thank you for your answer :) Maybe I didn't make myself clear. In the task of the 38th day, we created an application in which we add our expenses. I would like the title of the section to appear when a new expense is added. And disappeared when the section became empty. I would like to do this without using "isOn" I hope you can understand me. English is not my forte |
|
Toomaa clarifies his question:
Your use case depends on the state of your data model. Do you have expenses or not? You can answer this question by asking your expenses array if it is EMPTY. Then you make a decision to SHOW the section if the DO NOT create a
|
BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.
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.