- Interview Questions
- Concurrency Control
- Accessing Web Services
- iOS Development - Animations
- iOS Development - Auto Layouts
- iOS Development - Integrating Maps
- iOS Development - Advanced iOS
- Making Applications with Swift
- iOS Development - Swift Playground
- Making the App Interactive
- iOS Development - First Application
- iOS Development - Xcode IDE
- iOS Development - Home
iOS Development Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
iOS Development with Swift 2 - Playground
In this chapter, we will introduce a new environment where we can write and execute a swift code. We will also cover the following aspects of the swift playground −
Variables
Dictionaries
Arrays
Loops
Classes & Objects
Note − We will look only through those basic concepts, which we will be using in this tutorial, if you want to learn swift deeply, you can check our
.Playground is a tool provided with Xcode for executing the swift code. We will start by creating a new playground.
Starting Swift Playground
To create a swift playground, cpck on Xcode icon, and choose the first option, get started with a swift playground.
Give the name to your playground and select Platform as iOS. Let us name our playground as the Demo Playground. Cpck on Next.
These are the only steps you need to follow to make a Playground. The following screenshot shows the Playground.
Sr.No | Basic Concepts & Description |
---|---|
1 | A variable is a memory / storage that our program can use to store and manipulate data. Each variable has a specific data type, which determines the size that a variable will occupy in memory. |
2 | A dictionary is a collection that stores values in a key value pair, i.e. the data stored in a dictionary is stored in a method where each value is related to a key. Here, every key is unique and cannot appear twice in the same dictionary. |
3 | Arrays are the data types that store the same type of data in an ordered pst. The same value can appear at multiple indexes/Places in an array. |
4 | Swift provides a variety of Control Flow Statements. Loops are generally used to iterate over a condition or statement multiple times, until a Condition / Programmer’s need from that loop is satisfied. |
5 | Classes are the general-purpose flexible constructs that are the building blocks of your program’s code. Object is the term that is generally used to refer to instance of a class, so we can call it instance instead of objects. |