|
I went back to previous projects to fill the gaps. It's also an opportunity to ask questions I was embarrassed to ask.
So @NigelSee, or anyone else, please help me with this. I tried to do this with computed var or with didSet but the amount of my experience is not enough. It's not working. code I tried to implement but it isn't working causing several complaints from Xcode:
I know I'm missing something and the solution is shamefully simple probably but there's no other way to learn other than to try and to ask. I want to get better.
But ! When I do this and launch the app a problem occurs: I cant chose the Expense Type with a Picker. It's not "tappable" The only way how it's available to select is through a long tap on a Picker Field and with only what it redirects me to next page to chose between Personal and Business. Any ideas why this happens ? Thanks for your advices ! |
|
Don't think you need State here.
For dismissing the keyboard and if you're on iOS 16 you can use https://www.hackingwithswift.com/quick-start/swiftui/how-to-dismiss-the-keyboard-when-the-user-scrolls |
|
@Hatsushira Thanks for the proposed solution, sensei. Yes,sure it was Double as you mentioned, yes - comp.var. can't be used with @State. I remembered that moment. But something other is wrong. Tried. Here we go: What can be wrong now ? regarding the keyboard solution: I'm on iOS 15 still with Xcode 13. I hesitate if I should update. Still plenty of negative reviews on AppStore. Or should I go for version 14 anyway ? 🤔 |
|
For the first error, For the second error, you want to use |
|
@roosterboy, thank you for explanation ! The code to make it work eventually be like one below. I'm happy for now.
Next thing I faced was the formatting of the result on a screen. Here are all the options I could do. Of course I didn't touch extensions here. What would be the most elegant solution from Senior Developer point of view ? (The one with NSNumber is outdated as I understand ? )
|
|
And the problem with keyboard/picker relationship is still unresolved. Have no idea why that happens :( |
|
@ngknm14, quick question: how did you acheive to place the text list of expenses below the nav bar and before the list ? |
|
@Aizen, sorry for late reply. It's very easy. Inside of my List I put a Section, while ForEach is inside a Section, not the List. Making this you can add a "header" to your Section and make it look a way you want (sure with some limitations)
|
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's all new Paywall Editor allow you to remotely configure your paywall view without any code changes or app updates.
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.