SlideShare une entreprise Scribd logo
1  sur  16
Télécharger pour lire hors ligne
Mobile Application using Swift UI
Session 1: Introduction
By: Shehrevar Davierwala
Hello!
Class Rules
● Mutual Respect and Discipline
● Use mobiles when advised by course
incharge
● Silence is golden as it will help to
understand concepts well
● Maintain a book to note down all
important points and for assignments
● Be on time and notify for absence
Overview
Three key components in each lesson will guide your learning:
● Learn. A list of learning goals for that lesson
● Do. Hands-on practice with activities from the curriculum
● Reflect. Opportunities to design a personal project and plan
for the classroom
Instagram: @meetshehrevar
1. Xcode Setup
● Xcode is what is known as an integrated development environment or IDE for
short.
● If you don’t get this welcome
dialogue, then you can
always go up to the
“File” menu, go under “New,”
and then choose “Playground.”
Instagram: @meetshehrevar
Click on “Get started with a playground.” The dialog that pops up
allows you to choose what type of playground you want to create.
Instagram: @meetshehrevar
For the purposes of this course choose “Blank” under “iOS.”
You can save your playground anywhere you want. Make sure you remember
where you save it so you can easily access it.
Instagram: @meetshehrevar
Different Elements of the Playground
1. Code editor – this is where you’re going to be typing your Swift code.
2. Line numbers – these will help you
refer to different lines of code.
3. Status bar – tells you the current
status of the playground.
4. Show/Hide Debug – allows you to
hide or show the debug or console
area
5. Execute Playground – runs all the
code in your playground
Instagram: @meetshehrevar
Swift Variables
Consectetur nec labore Adipiscing elit sed Sed eiusmod
declare a variable called stockPrice and set it equal to the number 100
var stockPrice = 100
Instagram: @meetshehrevar
0
2
Swift Constants
A constant is a special type of variable whose value cannot be changed.
In Swift, we use the let keyword to declare constants. The value of a constant cannot be
changed.
For example,
let x = 5
x = 10 // Error
print(x)
main.swift:4:1: error: cannot assign to value: 'x' is a 'let' constant
Instagram: @meetshehrevar
Swift Data types
0
3
Instagram: @meetshehrevar
Examples
// create character type variable
var letter: Character = "s"
print(letter)
// Output: s
Note: If you try to assign more than one character like "abc" to variables of
Character type, you'll get an error message.
Instagram: @meetshehrevar
// create string type variable
var language: String = "swift"
print(language)
// Output: swift
// create integer type variable
var number: Int = 3
print(number)
// Output: 3
● Size: Depends on the platform type
● Range: -231 to 231-1 (32 bit platform)
-263 to 263-1 (64-bit platform)
Instagram: @meetshehrevar
// create boolean type variable
let passCheck: Bool = true
print(passCheck)
let failCheck: Bool = false
print(failCheck)
If we don't assign any value to a boolean
variable, it takes false as its default value.
// create float type variable
let piValue: Float = 3.14
print(piValue)
// Output: 3.14
● Size: 32-bit floating-point number
● Range: 1.2 x 10-38 to 3.4 x 1038 (Up to
6 decimal places)
Instagram: @meetshehrevar
// create double type variable
let latitude: Double = 27.7007697012432
print(latitude)
// Output: 27.7007697012432
● Size: 64-bit floating-point number
● Range: 2.3 x 10-308 to 1.7 x 10308
(Up to 15 decimal places)
Note: If we have a number like 27.7007697012432, we use:
● Double to store the number with more precision (up to 15 decimal places)
● Float to store the number with less precision (up to 6 decimal places)
Instagram: @meetshehrevar
Thank you.

Contenu connexe

Similaire à Introduction_Swift

Cis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programmingCis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programmingHamad Odhabi
 
Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)
Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)
Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)Aniruddha Chakrabarti
 
Visual basic asp.net programming introduction
Visual basic asp.net programming introductionVisual basic asp.net programming introduction
Visual basic asp.net programming introductionHock Leng PUAH
 
PART - 1 Python Introduction- Variables- Data types - Numeric- String- Boole...
PART - 1  Python Introduction- Variables- Data types - Numeric- String- Boole...PART - 1  Python Introduction- Variables- Data types - Numeric- String- Boole...
PART - 1 Python Introduction- Variables- Data types - Numeric- String- Boole...manikamr074
 
Approaches to teaching primary computing
Approaches to teaching primary computingApproaches to teaching primary computing
Approaches to teaching primary computingJEcomputing
 
The Ring programming language version 1.5.2 book - Part 174 of 181
The Ring programming language version 1.5.2 book - Part 174 of 181The Ring programming language version 1.5.2 book - Part 174 of 181
The Ring programming language version 1.5.2 book - Part 174 of 181Mahmoud Samir Fayed
 
iOS Development at Scale @Chegg
iOS Development at Scale @CheggiOS Development at Scale @Chegg
iOS Development at Scale @CheggGalOrlanczyk
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer muniryaseen
 
Oops concepts variables and How to handle variable in testing
Oops concepts variables and How to handle variable in testingOops concepts variables and How to handle variable in testing
Oops concepts variables and How to handle variable in testingNILESH SAWARDEKAR
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsRuth Marvin
 
The Ring programming language version 1.8 book - Part 93 of 202
The Ring programming language version 1.8 book - Part 93 of 202The Ring programming language version 1.8 book - Part 93 of 202
The Ring programming language version 1.8 book - Part 93 of 202Mahmoud Samir Fayed
 
Complete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptComplete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptEPAM Systems
 
Basic iOS Training with SWIFT - Part 1
Basic iOS Training with SWIFT - Part 1Basic iOS Training with SWIFT - Part 1
Basic iOS Training with SWIFT - Part 1Manoj Ellappan
 
One language to rule them all type script
One language to rule them all type scriptOne language to rule them all type script
One language to rule them all type scriptGil Fink
 
The Ring programming language version 1.5.4 book - Part 178 of 185
The Ring programming language version 1.5.4 book - Part 178 of 185The Ring programming language version 1.5.4 book - Part 178 of 185
The Ring programming language version 1.5.4 book - Part 178 of 185Mahmoud Samir Fayed
 
TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!Alessandro Giorgetti
 
01 Database Management (re-uploaded)
01 Database Management (re-uploaded)01 Database Management (re-uploaded)
01 Database Management (re-uploaded)bluejayjunior
 

Similaire à Introduction_Swift (20)

Cis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programmingCis 1403 lab1- the process of programming
Cis 1403 lab1- the process of programming
 
Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)
Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)
Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)
 
Visual basic asp.net programming introduction
Visual basic asp.net programming introductionVisual basic asp.net programming introduction
Visual basic asp.net programming introduction
 
PART - 1 Python Introduction- Variables- Data types - Numeric- String- Boole...
PART - 1  Python Introduction- Variables- Data types - Numeric- String- Boole...PART - 1  Python Introduction- Variables- Data types - Numeric- String- Boole...
PART - 1 Python Introduction- Variables- Data types - Numeric- String- Boole...
 
Approaches to teaching primary computing
Approaches to teaching primary computingApproaches to teaching primary computing
Approaches to teaching primary computing
 
The Ring programming language version 1.5.2 book - Part 174 of 181
The Ring programming language version 1.5.2 book - Part 174 of 181The Ring programming language version 1.5.2 book - Part 174 of 181
The Ring programming language version 1.5.2 book - Part 174 of 181
 
iOS Development at Scale @Chegg
iOS Development at Scale @CheggiOS Development at Scale @Chegg
iOS Development at Scale @Chegg
 
Unit 1
Unit 1Unit 1
Unit 1
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer
 
Oops concepts variables and How to handle variable in testing
Oops concepts variables and How to handle variable in testingOops concepts variables and How to handle variable in testing
Oops concepts variables and How to handle variable in testing
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
 
The Ring programming language version 1.8 book - Part 93 of 202
The Ring programming language version 1.8 book - Part 93 of 202The Ring programming language version 1.8 book - Part 93 of 202
The Ring programming language version 1.8 book - Part 93 of 202
 
Complete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptComplete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScript
 
Basic iOS Training with SWIFT - Part 1
Basic iOS Training with SWIFT - Part 1Basic iOS Training with SWIFT - Part 1
Basic iOS Training with SWIFT - Part 1
 
One language to rule them all type script
One language to rule them all type scriptOne language to rule them all type script
One language to rule them all type script
 
Chapter 2- Prog101.ppt
Chapter 2- Prog101.pptChapter 2- Prog101.ppt
Chapter 2- Prog101.ppt
 
The Ring programming language version 1.5.4 book - Part 178 of 185
The Ring programming language version 1.5.4 book - Part 178 of 185The Ring programming language version 1.5.4 book - Part 178 of 185
The Ring programming language version 1.5.4 book - Part 178 of 185
 
TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!
 
Dodo does-math
Dodo does-mathDodo does-math
Dodo does-math
 
01 Database Management (re-uploaded)
01 Database Management (re-uploaded)01 Database Management (re-uploaded)
01 Database Management (re-uploaded)
 

Plus de Shehrevar Davierwala

Plus de Shehrevar Davierwala (20)

PsudoCode.pptx
PsudoCode.pptxPsudoCode.pptx
PsudoCode.pptx
 
Number System.pptx
Number System.pptxNumber System.pptx
Number System.pptx
 
Java Script (Module 1).pptx
Java Script (Module 1).pptxJava Script (Module 1).pptx
Java Script (Module 1).pptx
 
Website in Clicks Day 2
Website in Clicks Day 2Website in Clicks Day 2
Website in Clicks Day 2
 
Develop Website in Clicks
Develop Website in ClicksDevelop Website in Clicks
Develop Website in Clicks
 
Build Virtual Assistant Using AI
Build Virtual Assistant Using AI Build Virtual Assistant Using AI
Build Virtual Assistant Using AI
 
Build brand reputation using facebook
Build brand reputation using facebookBuild brand reputation using facebook
Build brand reputation using facebook
 
Digital Marketing Session 2
Digital Marketing Session 2Digital Marketing Session 2
Digital Marketing Session 2
 
Learn Digital Marketing : 0 to Hero Day 1
Learn Digital Marketing :  0 to Hero Day 1 Learn Digital Marketing :  0 to Hero Day 1
Learn Digital Marketing : 0 to Hero Day 1
 
Standard template
Standard templateStandard template
Standard template
 
Digital Marketing for Sustainable Business - Afghan Perspective
Digital Marketing for Sustainable Business - Afghan Perspective  Digital Marketing for Sustainable Business - Afghan Perspective
Digital Marketing for Sustainable Business - Afghan Perspective
 
Developing stunning website in clicks - 2
Developing stunning website in clicks - 2Developing stunning website in clicks - 2
Developing stunning website in clicks - 2
 
Developing stunning website in clicks
Developing stunning website in clicksDeveloping stunning website in clicks
Developing stunning website in clicks
 
Google forms for data analysis
Google forms for data analysisGoogle forms for data analysis
Google forms for data analysis
 
Webdesign session1
Webdesign session1Webdesign session1
Webdesign session1
 
Tech talk webtech
Tech talk webtechTech talk webtech
Tech talk webtech
 
Tech talk php_cms
Tech talk php_cmsTech talk php_cms
Tech talk php_cms
 
Ph pbasics
Ph pbasicsPh pbasics
Ph pbasics
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
Java operators
Java operatorsJava operators
Java operators
 

Dernier

Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 

Dernier (20)

Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 

Introduction_Swift

  • 1. Mobile Application using Swift UI Session 1: Introduction By: Shehrevar Davierwala
  • 3. Class Rules ● Mutual Respect and Discipline ● Use mobiles when advised by course incharge ● Silence is golden as it will help to understand concepts well ● Maintain a book to note down all important points and for assignments ● Be on time and notify for absence
  • 4. Overview Three key components in each lesson will guide your learning: ● Learn. A list of learning goals for that lesson ● Do. Hands-on practice with activities from the curriculum ● Reflect. Opportunities to design a personal project and plan for the classroom Instagram: @meetshehrevar
  • 5. 1. Xcode Setup ● Xcode is what is known as an integrated development environment or IDE for short. ● If you don’t get this welcome dialogue, then you can always go up to the “File” menu, go under “New,” and then choose “Playground.” Instagram: @meetshehrevar
  • 6. Click on “Get started with a playground.” The dialog that pops up allows you to choose what type of playground you want to create. Instagram: @meetshehrevar
  • 7. For the purposes of this course choose “Blank” under “iOS.” You can save your playground anywhere you want. Make sure you remember where you save it so you can easily access it. Instagram: @meetshehrevar
  • 8. Different Elements of the Playground 1. Code editor – this is where you’re going to be typing your Swift code. 2. Line numbers – these will help you refer to different lines of code. 3. Status bar – tells you the current status of the playground. 4. Show/Hide Debug – allows you to hide or show the debug or console area 5. Execute Playground – runs all the code in your playground Instagram: @meetshehrevar
  • 9. Swift Variables Consectetur nec labore Adipiscing elit sed Sed eiusmod declare a variable called stockPrice and set it equal to the number 100 var stockPrice = 100 Instagram: @meetshehrevar
  • 10. 0 2 Swift Constants A constant is a special type of variable whose value cannot be changed. In Swift, we use the let keyword to declare constants. The value of a constant cannot be changed. For example, let x = 5 x = 10 // Error print(x) main.swift:4:1: error: cannot assign to value: 'x' is a 'let' constant Instagram: @meetshehrevar
  • 12. Examples // create character type variable var letter: Character = "s" print(letter) // Output: s Note: If you try to assign more than one character like "abc" to variables of Character type, you'll get an error message. Instagram: @meetshehrevar
  • 13. // create string type variable var language: String = "swift" print(language) // Output: swift // create integer type variable var number: Int = 3 print(number) // Output: 3 ● Size: Depends on the platform type ● Range: -231 to 231-1 (32 bit platform) -263 to 263-1 (64-bit platform) Instagram: @meetshehrevar
  • 14. // create boolean type variable let passCheck: Bool = true print(passCheck) let failCheck: Bool = false print(failCheck) If we don't assign any value to a boolean variable, it takes false as its default value. // create float type variable let piValue: Float = 3.14 print(piValue) // Output: 3.14 ● Size: 32-bit floating-point number ● Range: 1.2 x 10-38 to 3.4 x 1038 (Up to 6 decimal places) Instagram: @meetshehrevar
  • 15. // create double type variable let latitude: Double = 27.7007697012432 print(latitude) // Output: 27.7007697012432 ● Size: 64-bit floating-point number ● Range: 2.3 x 10-308 to 1.7 x 10308 (Up to 15 decimal places) Note: If we have a number like 27.7007697012432, we use: ● Double to store the number with more precision (up to 15 decimal places) ● Float to store the number with less precision (up to 6 decimal places) Instagram: @meetshehrevar