Book Image

Swift Cookbook

By : Cecil Costa, Cecil Costa
Book Image

Swift Cookbook

By: Cecil Costa, Cecil Costa

Overview of this book

Table of Contents (18 chapters)
Swift Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Exchanging money


Nowadays, our apps must be prepared to be executed everywhere; therefore, your app should have as many languages as possible. Consider that internationalization is very important for using different languages to a different number of formats.

In this recipe, we will create an app that will show us the currency exchange rate, but more important than that is it will be adapted to the current location.

Getting ready

Create a single view application called Chapter 11 Currency Converter and place the two flag pictures on images.xcassets. These pictures can be downloaded from the book resources.

How to do it...

Follow these steps to create the Currency Converter app:

  1. Firstly, click on the supporting files group and add a new file. In this case, go to the Resource section and select Strings File:

  2. Inside this file, add some of these keys with their corresponding values:

    "Rate" = "Rate: %@";
    "Total" = "Total: %@";
    "Choose Currency" = "Choose a currency";
    "flagicon" = "english";
    "Cancel"...