UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Use the user’s preferred currency, rather than always using US dollars.

Forums > 100 Days of SwiftUI

Hi guys!Please help me with project 7

2      

Not exactly sure where your problem lies, but the following link contains a lot of information on currency symbols and currency formatting:

[https://www.hackingwithswift.com/forums/100-days-of-swiftui/day-38-iexpense-challenge-a-few-issues-remain/14514]

As you can see, changing the currency symbol is easy. The difficulty lies in getting the formatting right.

2      

Hi,

Not sure if your are talking about the same issue I had - In one of the first projects (the tip calculator) I was using the local currency but kept getting $ - I had to change the regional settings in the phone simulator to UK before I could get £

Greenie

2      

For me, even this was not enough. I did get the right symbol, but I also wanted local formatting (thousands separator, etc). For this,I had to change the development language. See https://developer.apple.com/forums/thread/706739.

2      

I just want let user chose currency(USD, EURO, CAD...).

2      

To (freely) quote Obelix from another thread: Do you want the answer, or do you want to learn?

If the latter, here is something to help you on your way.

It all depends on how you read the challenge.

If all you want to do is choose the user's preferred currency symbol for him/her, (assuming you know what it is), all you have to do is review the lesson, and the answer will be staring you in the face. This is how I understood the challenge, and it is really easy to do.

(Do you perhaps copy the code from the lesson into your project? Then the solution would be easy to miss. Or do you enter it manually? You should!)

If, however, you read the challenge as: Let the user choose the currency symbol while using the app, then you will need to create some dialog. Ask yourself: How would that look like? Maybe you want to let the user choose from a list you provide. What type of view do you know that allows you to do that? Or maybe you want to do it differently. It is up to you.

Good luck.

2      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

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.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.