|
Good afternoon everyone. I have a block of text fields combined with an array of structures. And it is possible to check the completion of the fields not immediately but by clicking a button. When clicked, it will be displayed which fields are not filled in. There is no idea of implementation at all. 🙄
|
|
Hi Steven, for that purpose there is |
|
As promised. You can have a look how to monitor all those textfields and apply your logic in your project.
PS. If you comment out |
SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets! Sponsor Hacking with Swift and reach the world's largest Swift community! |
|
Good afternoon, Mr. @ygeras, very grateful for the help I'm trying to change the background of a text field if the field is empty. Check after pressing the button. I’m thinking about how to transfer the check to a higher level. Since this is an array of cards with text fields. I'm still trying to figure out this method of transferring data. Calling Method on Child View in SwiftUI
|
|
I know you have some logic behind your code, but without have more details on how data is passed around it is diffucult to conclude how you handle it behind the scenes. Try to paste the below code and have a look at the implementation. Maybe you could use some kind of the same approach. Seem like should work in your case if implemented wisely.
|
|
Another option to try using Combine. As you can see all checks are done in your viewModel.
|
|
Hi Mr. @ygeras! Really appreciate your time and help! Posted the file on git with example code. This is link GitHub Files with example code - CardTourist and BookingView Now I’ll try to do in After Effects what I would like to implement. Your Mr. @ygeras code works great! I'll try to adapt it to suit myself. All I have to do is read about the @Publisher, otherwise it turns out I don’t know a lot. |
|
Everything worked out Mr. @ygeras 🥳 I just looped through the array and used your example code! |
|
Glad to hear that Steven! Just small note. For proper work and to avoidance of memory leak, it is better to modify code slightly for Combine way appropriate. This is has to do with pipeline still working and publishing data after the class is deinitialized. I know that might sound compicated, but it is really that a bit complex. Even myself not so super proficient in Combine. Consider to update to this.
The code still continues to work as before. |
|
Hi, Mr. @ygeras!
Every publisher needs to be closed to avoid memory leaks? |
|
SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.