- Swift - Access Control
- Swift - Generics
- Swift - Protocols
- Swift - Extensions
- Swift - Type Casting
- Swift - Optional Chaining
- Swift - ARC Overview
- Swift - Deinitialization
- Swift - Initialization
- Swift - Inheritance
- Swift - Subscripts
- Swift - Methods
- Swift - Properties
- Swift - Classes
- Swift - Structures
- Swift - Enumerations
- Swift - Closures
- Swift - Functions
- Swift - Dictionaries
- Swift - Sets
- Swift - Arrays
- Swift - Characters
- Swift - Strings
- Swift - Loops
- Swift - Decision Making
- Swift - Operators
- Swift - Literals
- Swift - Constants
- Swift - Tuples
- Swift - Optionals
- Swift - Variables
- Swift - Data Types
- Swift - Basic Syntax
- Swift - Environment
- Swift - Overview
- Swift - Home
Swift Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Swift - Environment
Local Environment Setup
Swift 4 provides a Playground platform for learning purpose and we are going to setup the same. You need xCode software to start your Swift 4 coding in Playground. Once you are comfortable with the concepts of Swift 4, you can use xCode IDE for iOS/OS x apppcation development.
To start with, we consider you already have an account at Apple Developer website. Once you are logged in, go to the following pnk −
This will pst down a number of software available as follows −
Now select xCode and download it by cpcking on the given pnk near to disc image. After downloading the dmg file, you can install it by simply double-cpcking on it and following the given instructions. Finally, follow the given instructions and drop xCode icon into the Apppcation folder.
Now you have xCode installed on your machine. Next, open Xcode from the Apppcation folder and proceed after accepting the terms and conditions. If everything is fine, you will get the following screen −
Select Get started with a playground option and enter a name for playground and select iOS as platform. Finally, you will get the Playground window as follows −
Following is the code taken from the default Swift 4 Playground Window.
import UIKit var str = "Hello, playground"
If you create the same program for OS X program, then it will include import Cocoa and the program will look pke as follows −
import Cocoa var str = "Hello, playground"
When the above program gets loaded, it should display the following result in Playground result area (Right Hand Side).
Hello, playground
Congratulations, you have your Swift 4 programming environment ready and you can proceed with your learning vehicle "Tutorials Point".
Advertisements