-
Book Overview & Buying
-
Table Of Contents
Swift Cookbook
By :
Sometimes, we need to add some icons on our application, but depending on the icon you want, it's not necessary to add an image; you can use Unicode characters. Let's create a quiz app using strings alone.
The idea for this app is to create an app where the user needs to answer a question in 12 seconds. After the last quiz, the app will show to the user his score, such as the number of well-answered and badly-answered questions.
Once we know the concept of this program, let's create a new project and name it Chapter 2 Unicode.
To create a quiz app, follow these steps:
First, let's create a new file called Quiz and add a class with a question to it, with three possible answers and the right answer, as follows:
class Quiz {
var question:String
// First possible answer
var ①:String
// second possible answer
var ②:String
// third possible answer
var ③:String
// Right answer
var 👌:Int
init(question:String,...
Change the font size
Change margin width
Change background colour