SlideShare a Scribd company logo
Dive Into Swift
Kristijan Frankovic
Swift
 Powerful, intuitive, safe, fast, interactive, concise…
 iOS, OS X, watchOS
 Object-oriented, functional, static, strong typing…
 Beta – June 2014
 1.0 – September 2014
 1.2 – April 2015
 2.1 – October 21, 2015
Swift 1.2 vs 2.1
 Xcode 6 (1.2) -> Xcode 7 (2.x) – bunch of syntax errors
 Migration assistant (Edit / Convert / To latest
 println -> print
 Join (“”, components) -> components.joinWithSeparator(“”)
 Error handling (1.2)
var error: NSError?
var something = context!.executeFetchRequest(request, error: &error)
 Error handling (2.x)
do {
var something = context.executeFetchRequest(request)
} catch let error as NSError {
// do something with error
}
Swift vs Objective-C
 Objective-C:
Person *franc = [[Person alloc] initWithName:@"Kristijan"];
[franc sayHello];
var franc = Person(name:"Kristijan")
franc.sayHello()
 Swift:
Objective-C Compatibility
 Bridging
 iOS was developed in Objective-C
 Virtually all iOS API is accessible seamlessly from Swift
 Special data types – easier use of iOS API from Obj-c
 NSString, NSArray, NSDictionary, NSNumber (int, float, double, bool)
 Import Objective-C code in Swift project and vice-versa
Demo
Demo code is available at GitHub Gist:
https://gist.github.com/kfrankovic/61da4e0210e4861603e1
More info…
 iOS Developer Library – The Swift Programming Language
 https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/
Swift_Programming_Language/index.html
 Stanford – Developing iOS 8 Apps with Swift [2015] (CS193p, Winter 2015)
 https://www.youtube.com/watch?v=GOEPVM5OzJk&list=PLy7oRd3ashWodnpf8rjfYEk
TgwbOEsKfU
 Google 

More Related Content

Viewers also liked (7)

Should you react?
Should you react?Should you react?
Should you react?
Axilis
 
Diving into Node with Express and Mongo
Diving into Node with Express and MongoDiving into Node with Express and Mongo
Diving into Node with Express and Mongo
Axilis
 
Sweet ES2015 (ES6) Taste
Sweet ES2015 (ES6) TasteSweet ES2015 (ES6) Taste
Sweet ES2015 (ES6) Taste
Axilis
 
NPM, Bower and Gulp Kickstart in Visual Studio
 NPM, Bower and Gulp Kickstart in Visual Studio NPM, Bower and Gulp Kickstart in Visual Studio
NPM, Bower and Gulp Kickstart in Visual Studio
Axilis
 
Road to Dynamic LINQ - Part 2
 Road to Dynamic LINQ - Part 2 Road to Dynamic LINQ - Part 2
Road to Dynamic LINQ - Part 2
Axilis
 
Wireframing
WireframingWireframing
Wireframing
Axilis
 
Quick introduction to zeplin
Quick introduction to zeplinQuick introduction to zeplin
Quick introduction to zeplin
Axilis
 
Should you react?
Should you react?Should you react?
Should you react?
Axilis
 
Diving into Node with Express and Mongo
Diving into Node with Express and MongoDiving into Node with Express and Mongo
Diving into Node with Express and Mongo
Axilis
 
Sweet ES2015 (ES6) Taste
Sweet ES2015 (ES6) TasteSweet ES2015 (ES6) Taste
Sweet ES2015 (ES6) Taste
Axilis
 
NPM, Bower and Gulp Kickstart in Visual Studio
 NPM, Bower and Gulp Kickstart in Visual Studio NPM, Bower and Gulp Kickstart in Visual Studio
NPM, Bower and Gulp Kickstart in Visual Studio
Axilis
 
Road to Dynamic LINQ - Part 2
 Road to Dynamic LINQ - Part 2 Road to Dynamic LINQ - Part 2
Road to Dynamic LINQ - Part 2
Axilis
 
Wireframing
WireframingWireframing
Wireframing
Axilis
 
Quick introduction to zeplin
Quick introduction to zeplinQuick introduction to zeplin
Quick introduction to zeplin
Axilis
 

Similar to Dive Into Swift (9)

Programming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for AndroidProgramming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for Android
Emanuele Di Saverio
 
Code Generation for Azure with .net
Code Generation for Azure with .netCode Generation for Azure with .net
Code Generation for Azure with .net
Marco Parenzan
 
Escape from Mars
Escape from MarsEscape from Mars
Escape from Mars
Jorge Ortiz
 
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
jeffz
 
iPhone Development Intro
iPhone Development IntroiPhone Development Intro
iPhone Development Intro
Luis Azevedo
 
React native
React nativeReact native
React native
Mohammed El Rafie Tarabay
 
Kotlin , Android
Kotlin , Android Kotlin , Android
Kotlin , Android
Ubuntu
 
Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"
Hyuk Hur
 
training for ASE
training for ASEtraining for ASE
training for ASE
Corneliu Moisei
 
Programming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for AndroidProgramming Sideways: Asynchronous Techniques for Android
Programming Sideways: Asynchronous Techniques for Android
Emanuele Di Saverio
 
Code Generation for Azure with .net
Code Generation for Azure with .netCode Generation for Azure with .net
Code Generation for Azure with .net
Marco Parenzan
 
Escape from Mars
Escape from MarsEscape from Mars
Escape from Mars
Jorge Ortiz
 
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
jeffz
 
iPhone Development Intro
iPhone Development IntroiPhone Development Intro
iPhone Development Intro
Luis Azevedo
 
Kotlin , Android
Kotlin , Android Kotlin , Android
Kotlin , Android
Ubuntu
 
Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"Let'swift "Concurrency in swift"
Let'swift "Concurrency in swift"
Hyuk Hur
 

More from Axilis (7)

Web App Security for Devs
Web App Security for DevsWeb App Security for Devs
Web App Security for Devs
Axilis
 
React tips
React tipsReact tips
React tips
Axilis
 
Configuring SSL on NGNINX and less tricky servers
Configuring SSL on NGNINX and less tricky serversConfiguring SSL on NGNINX and less tricky servers
Configuring SSL on NGNINX and less tricky servers
Axilis
 
Angular 2.0: Getting ready
Angular 2.0: Getting readyAngular 2.0: Getting ready
Angular 2.0: Getting ready
Axilis
 
Angular JS deep dive
Angular JS deep diveAngular JS deep dive
Angular JS deep dive
Axilis
 
Micro ORM vs Entity Framework
Micro ORM vs Entity FrameworkMicro ORM vs Entity Framework
Micro ORM vs Entity Framework
Axilis
 
A brief introduction to Code Review
A brief introduction to Code ReviewA brief introduction to Code Review
A brief introduction to Code Review
Axilis
 
Web App Security for Devs
Web App Security for DevsWeb App Security for Devs
Web App Security for Devs
Axilis
 
React tips
React tipsReact tips
React tips
Axilis
 
Configuring SSL on NGNINX and less tricky servers
Configuring SSL on NGNINX and less tricky serversConfiguring SSL on NGNINX and less tricky servers
Configuring SSL on NGNINX and less tricky servers
Axilis
 
Angular 2.0: Getting ready
Angular 2.0: Getting readyAngular 2.0: Getting ready
Angular 2.0: Getting ready
Axilis
 
Angular JS deep dive
Angular JS deep diveAngular JS deep dive
Angular JS deep dive
Axilis
 
Micro ORM vs Entity Framework
Micro ORM vs Entity FrameworkMicro ORM vs Entity Framework
Micro ORM vs Entity Framework
Axilis
 
A brief introduction to Code Review
A brief introduction to Code ReviewA brief introduction to Code Review
A brief introduction to Code Review
Axilis
 

Recently uploaded (20)

Secure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdfSecure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Northwind Technologies
 
Issues in AI Presentation and machine learning.pptx
Issues in AI Presentation and machine learning.pptxIssues in AI Presentation and machine learning.pptx
Issues in AI Presentation and machine learning.pptx
Jalalkhan657136
 
Intranet Examples That Are Changing the Way We Work
Intranet Examples That Are Changing the Way We WorkIntranet Examples That Are Changing the Way We Work
Intranet Examples That Are Changing the Way We Work
BizPortals Solutions
 
Marketing And Sales Software Services.pptx
Marketing And Sales Software Services.pptxMarketing And Sales Software Services.pptx
Marketing And Sales Software Services.pptx
julia smits
 
Top 10 Mobile Banking Apps in the USA.pdf
Top 10 Mobile Banking Apps in the USA.pdfTop 10 Mobile Banking Apps in the USA.pdf
Top 10 Mobile Banking Apps in the USA.pdf
LL Technolab
 
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROIAutoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Udit Goenka
 
German Marketo User Group - May 2025 survey results
German Marketo User Group - May 2025 survey resultsGerman Marketo User Group - May 2025 survey results
German Marketo User Group - May 2025 survey results
BradBedford3
 
Why-Choose-an-Authorised-Microsoft-Reseller.pptx
Why-Choose-an-Authorised-Microsoft-Reseller.pptxWhy-Choose-an-Authorised-Microsoft-Reseller.pptx
Why-Choose-an-Authorised-Microsoft-Reseller.pptx
Michael cole
 
Key Characteristics of High-Performing Insurance Broker Software
Key Characteristics of High-Performing Insurance Broker SoftwareKey Characteristics of High-Performing Insurance Broker Software
Key Characteristics of High-Performing Insurance Broker Software
Insurance Tech Services
 
Optimising Claims Management with Claims Processing Systems
Optimising Claims Management with Claims Processing SystemsOptimising Claims Management with Claims Processing Systems
Optimising Claims Management with Claims Processing Systems
Insurance Tech Services
 
zOS CommServer support for the Network Express feature on z17
zOS CommServer support for the Network Express feature on z17zOS CommServer support for the Network Express feature on z17
zOS CommServer support for the Network Express feature on z17
zOSCommserver
 
Custom Software Development: Types, Applications and Benefits.pdf
Custom Software Development: Types, Applications and Benefits.pdfCustom Software Development: Types, Applications and Benefits.pdf
Custom Software Development: Types, Applications and Benefits.pdf
Digital Aptech
 
Climate-Smart Agriculture Development Solution.pptx
Climate-Smart Agriculture Development Solution.pptxClimate-Smart Agriculture Development Solution.pptx
Climate-Smart Agriculture Development Solution.pptx
julia smits
 
Oliveira2024 - Combining GPT and Weak Supervision.pdf
Oliveira2024 - Combining GPT and Weak Supervision.pdfOliveira2024 - Combining GPT and Weak Supervision.pdf
Oliveira2024 - Combining GPT and Weak Supervision.pdf
GiliardGodoi1
 
Introduction to QM, QA, QC, Bug's priority and severity
Introduction to QM, QA, QC, Bug's priority and severityIntroduction to QM, QA, QC, Bug's priority and severity
Introduction to QM, QA, QC, Bug's priority and severity
Arshad QA
 
grade 9 ai project cycle Artificial intelligence.pptx
grade 9 ai project cycle Artificial intelligence.pptxgrade 9 ai project cycle Artificial intelligence.pptx
grade 9 ai project cycle Artificial intelligence.pptx
manikumar465287
 
And overview of Nasdanika Models and their applications
And overview of Nasdanika Models and their applicationsAnd overview of Nasdanika Models and their applications
And overview of Nasdanika Models and their applications
Pavel Vlasov
 
What's-New-with-BoxLang-Brad Wood.pptx.pdf
What's-New-with-BoxLang-Brad Wood.pptx.pdfWhat's-New-with-BoxLang-Brad Wood.pptx.pdf
What's-New-with-BoxLang-Brad Wood.pptx.pdf
Ortus Solutions, Corp
 
Improving Engagement with CRM Software for Instance Agents
Improving Engagement with CRM Software for Instance AgentsImproving Engagement with CRM Software for Instance Agents
Improving Engagement with CRM Software for Instance Agents
Insurance Tech Services
 
Top 5 Odoo Modules for the EPC Industry.pdf
Top 5 Odoo Modules for the EPC Industry.pdfTop 5 Odoo Modules for the EPC Industry.pdf
Top 5 Odoo Modules for the EPC Industry.pdf
SatishKumar2651
 
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdfSecure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Secure and Simplify IT Management with ManageEngine Endpoint Central.pdf
Northwind Technologies
 
Issues in AI Presentation and machine learning.pptx
Issues in AI Presentation and machine learning.pptxIssues in AI Presentation and machine learning.pptx
Issues in AI Presentation and machine learning.pptx
Jalalkhan657136
 
Intranet Examples That Are Changing the Way We Work
Intranet Examples That Are Changing the Way We WorkIntranet Examples That Are Changing the Way We Work
Intranet Examples That Are Changing the Way We Work
BizPortals Solutions
 
Marketing And Sales Software Services.pptx
Marketing And Sales Software Services.pptxMarketing And Sales Software Services.pptx
Marketing And Sales Software Services.pptx
julia smits
 
Top 10 Mobile Banking Apps in the USA.pdf
Top 10 Mobile Banking Apps in the USA.pdfTop 10 Mobile Banking Apps in the USA.pdf
Top 10 Mobile Banking Apps in the USA.pdf
LL Technolab
 
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROIAutoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Autoposting.ai Sales Deck - Skyrocket your LinkedIn's ROI
Udit Goenka
 
German Marketo User Group - May 2025 survey results
German Marketo User Group - May 2025 survey resultsGerman Marketo User Group - May 2025 survey results
German Marketo User Group - May 2025 survey results
BradBedford3
 
Why-Choose-an-Authorised-Microsoft-Reseller.pptx
Why-Choose-an-Authorised-Microsoft-Reseller.pptxWhy-Choose-an-Authorised-Microsoft-Reseller.pptx
Why-Choose-an-Authorised-Microsoft-Reseller.pptx
Michael cole
 
Key Characteristics of High-Performing Insurance Broker Software
Key Characteristics of High-Performing Insurance Broker SoftwareKey Characteristics of High-Performing Insurance Broker Software
Key Characteristics of High-Performing Insurance Broker Software
Insurance Tech Services
 
Optimising Claims Management with Claims Processing Systems
Optimising Claims Management with Claims Processing SystemsOptimising Claims Management with Claims Processing Systems
Optimising Claims Management with Claims Processing Systems
Insurance Tech Services
 
zOS CommServer support for the Network Express feature on z17
zOS CommServer support for the Network Express feature on z17zOS CommServer support for the Network Express feature on z17
zOS CommServer support for the Network Express feature on z17
zOSCommserver
 
Custom Software Development: Types, Applications and Benefits.pdf
Custom Software Development: Types, Applications and Benefits.pdfCustom Software Development: Types, Applications and Benefits.pdf
Custom Software Development: Types, Applications and Benefits.pdf
Digital Aptech
 
Climate-Smart Agriculture Development Solution.pptx
Climate-Smart Agriculture Development Solution.pptxClimate-Smart Agriculture Development Solution.pptx
Climate-Smart Agriculture Development Solution.pptx
julia smits
 
Oliveira2024 - Combining GPT and Weak Supervision.pdf
Oliveira2024 - Combining GPT and Weak Supervision.pdfOliveira2024 - Combining GPT and Weak Supervision.pdf
Oliveira2024 - Combining GPT and Weak Supervision.pdf
GiliardGodoi1
 
Introduction to QM, QA, QC, Bug's priority and severity
Introduction to QM, QA, QC, Bug's priority and severityIntroduction to QM, QA, QC, Bug's priority and severity
Introduction to QM, QA, QC, Bug's priority and severity
Arshad QA
 
grade 9 ai project cycle Artificial intelligence.pptx
grade 9 ai project cycle Artificial intelligence.pptxgrade 9 ai project cycle Artificial intelligence.pptx
grade 9 ai project cycle Artificial intelligence.pptx
manikumar465287
 
And overview of Nasdanika Models and their applications
And overview of Nasdanika Models and their applicationsAnd overview of Nasdanika Models and their applications
And overview of Nasdanika Models and their applications
Pavel Vlasov
 
What's-New-with-BoxLang-Brad Wood.pptx.pdf
What's-New-with-BoxLang-Brad Wood.pptx.pdfWhat's-New-with-BoxLang-Brad Wood.pptx.pdf
What's-New-with-BoxLang-Brad Wood.pptx.pdf
Ortus Solutions, Corp
 
Improving Engagement with CRM Software for Instance Agents
Improving Engagement with CRM Software for Instance AgentsImproving Engagement with CRM Software for Instance Agents
Improving Engagement with CRM Software for Instance Agents
Insurance Tech Services
 
Top 5 Odoo Modules for the EPC Industry.pdf
Top 5 Odoo Modules for the EPC Industry.pdfTop 5 Odoo Modules for the EPC Industry.pdf
Top 5 Odoo Modules for the EPC Industry.pdf
SatishKumar2651
 

Dive Into Swift

  • 2. Swift  Powerful, intuitive, safe, fast, interactive, concise…  iOS, OS X, watchOS  Object-oriented, functional, static, strong typing…  Beta – June 2014  1.0 – September 2014  1.2 – April 2015  2.1 – October 21, 2015
  • 3. Swift 1.2 vs 2.1  Xcode 6 (1.2) -> Xcode 7 (2.x) – bunch of syntax errors  Migration assistant (Edit / Convert / To latest  println -> print  Join (“”, components) -> components.joinWithSeparator(“”)  Error handling (1.2) var error: NSError? var something = context!.executeFetchRequest(request, error: &error)  Error handling (2.x) do { var something = context.executeFetchRequest(request) } catch let error as NSError { // do something with error }
  • 4. Swift vs Objective-C  Objective-C: Person *franc = [[Person alloc] initWithName:@"Kristijan"]; [franc sayHello]; var franc = Person(name:"Kristijan") franc.sayHello()  Swift:
  • 5. Objective-C Compatibility  Bridging  iOS was developed in Objective-C  Virtually all iOS API is accessible seamlessly from Swift  Special data types – easier use of iOS API from Obj-c  NSString, NSArray, NSDictionary, NSNumber (int, float, double, bool)  Import Objective-C code in Swift project and vice-versa
  • 6. Demo Demo code is available at GitHub Gist: https://gist.github.com/kfrankovic/61da4e0210e4861603e1
  • 7. More info…  iOS Developer Library – The Swift Programming Language  https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/ Swift_Programming_Language/index.html  Stanford – Developing iOS 8 Apps with Swift [2015] (CS193p, Winter 2015)  https://www.youtube.com/watch?v=GOEPVM5OzJk&list=PLy7oRd3ashWodnpf8rjfYEk TgwbOEsKfU  Google 