|
Im starting to learn SwiftUI a month ago and now i create an App. Would anyone be willing to watch my code and make a review? I posted code in GitHub (https://github.com/Spich3000/stonksProfitCalculator-1.01). Thanks in advance! |
|
Hi Dimitry Welcome to this forum and good luck learning SwiftUI. I think Hacking With Swift is a really great resource. Keep on learning! I looked at your source code and have the following suggestions for improvements:
|
|
@pd95 Thank you so much! I will try to fix this as soon as possible. This is really helpfull cause i dont know how to write code right. Hope i can figure out how to handle it :3 Thank you again! |
SPONSORED AppSweep by Guardsquare helps developers automate the mobile app security testing process with fast, free scans. By using AppSweep’s actionable recommendations, developers can improve the security posture of their apps in accordance with security standards like OWASP. Sponsor Hacking with Swift and reach the world's largest Swift community! |
|
Hi Sorry that I took awhile to reply, was just see what would be take. Here my finding. ContentViewFirstly as
A couple of thing used View ModifierIf the ViewModifier do not take any parmeter then if you put an extension with a computed property like
or if take parmeter use a method like
Then you can use like
TextFieldsI was wondering what the convert a string replacing Display TextYou can use a format to display Number (percent and currency correctly)
LocalizableAs
PS You can run the App the in Russain by Click in "Product" then hold Option and the click "Run" then change the App Language to Russain. This then will show Russain in the Previews. I have stopped there but i would look at refactor the "Tabs" to make them smaller and also look at moving the logic out of the View to thier own file. Sorry this is so long but the all the changes are on my GitHub |
|
@NigelGee Wow! Great thanks for you! Thats a lot of work, thank you so much :3 I finished today with localization: add Russian and Ukranian, but how can i select language manualy? When i build app it shows language based on a system region. But i want English.
I was searching for a week to find review and finaly found this beautiful site! Really hard learning alone, but its so cool to find out how all this things works. Thank you so much for your help <3 |
|
Regarding the English version best is to add the English Localization (same as when you added Ukranian) then when you do Option Run you can select the English version and this will stay until you change it. PS if you run a real device you can select the Language that the App run in to. I would recomend that you do 100 Days of SwiftUI, It a great course and some of these question might be clearer. PSS you can alway download my project from GitHub and look at the code I did if something does not work Have fun and happy coding |
|
@NigelGee Oh i got it. I will try see into with your code. Already subcribe to your Git acc :-) Thank you so much! |
|
@NigelGee How can i bind FocusState variable in ContentView with other views? I see in concole that when i press button in toolbar, focus changed to false, but its not going to other views where i need to close keyboard. |
|
I handle it with UIKit:
And then add |
|
I tried to change format to .number in TextField inputs and it's not working right:
I tried my convert function on a UK region (switch my phone to United Kindom region, and British English language). App works fine like i planed! Formulas are looking more chaotic with this function and convert to Double value, but i hope this is fine. |
SPONSORED AppSweep by Guardsquare helps developers automate the mobile app security testing process with fast, free scans. By using AppSweep’s actionable recommendations, developers can improve the security posture of their apps in accordance with security standards like OWASP.
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.