WWDC24 SALE: Save 50% on all my Swift books and bundles! >>

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      

Save 50% in my WWDC sale.

SAVE 50% To celebrate WWDC24, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

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.