SlideShare a Scribd company logo
1 of 33
What’s new in Swift 3?
Pushkar N Kulkarni | @pushkar_nk | pushkarnk
IBM Runtimes
IBM India Software Lab
Agenda
• Swift@IBM - a server-side effort
• Language changes in Swift 3.0 (hands-on)
• Swift Package Manager (hands-on)
Swift@IBM
• Swift on Linux – swift.org
• IBM Swift Package Catalog
• Kitura
• IBM Swift Sandbox
Blog: https://developer.ibm.com/swift/blogs/
Swift on Linux
IBM Swift Package Catalog
• https://swiftpkgs.ng.bluemix.net/
• Find, explore and share packages
from the open-source Swift
ecosystem
• Explore dependencies
• Submit your own packages
5
Kitura Web Framework
What is it?
• New, modular, package-based web framework
written in Swift
Why is this cool?
• Empower a new generation of native mobile
developers to write and deploy code into the
Cloud.
Developer Benefits ?
• Delivers core technologies needed to
stand up enterprise apps on the server
• Enables developers to create a web
application in Swift and deploy these
servers on Linux and the Cloud.
http://github.com/ibm-swift/kitura 6
IBM Swift Sandbox
• Interactive sandbox for
rapid prototyping and
experimentation in Swift
• Saves your work
• Supports multiple
versions of Swift
• Responsive design
7
https://swiftlang.ng.bluemix.net/
Swift 3.0
• Major release
• Not source-compatible with Swift 2.2
• Fundamental changes to the language and standard library
• Swift package manager – Linux & Darwin
Language changes
• Removal of C-style for-loops
• Removal of increment/decrement operators
• New function to find first element passing a predicate
• Consistent label behavior for first parameter
Language changes
• New API guidelines
• Keywords in member references
• Case labels with multiple patterns
• Generic type-aliasing
C-Style code (Swift 2.2)
func arithmeticSeries(a: Int, d: Int, n: Int) -> [Int] {
var series: [Int] = []
for var i = 0; i < n; i++ {
series += [a + i*d]
}
return series
}
arithmeticSeries(1, d: 3, n: 10)
C-style constructs removed
//this works on all Swift versions
func arithmeticSeries(a: Int, d: Int, n: Int) -> [Int] {
var series: [Int] = []
for i in 0..<n {
series += [a+i*d]
}
return series
}
print(arithmeticSeries(1, d: 3, n: 10))
Sequence iteration - stdlib
func arithmeticSeries(a: Int, d: Int, n: Int) -> [Int] {
var series: [Int] = []
for x in sequence(first: a, next: {$0+d}).prefix(n){
series += [x]
}
return series
}
print(arithmeticSeries(a: 1, d: 3, n: 10))
Sequence.first(where:)
Finding the first element that satisfies a predicate
let series = arithmeticSeries(a: 1, d: 3, n: 10)
//first double digit element
series.first(where: {$0 > 9})
Consistent label behavior for first parameter
Until Swift 2.2
func sum (x a: Int, y b: Int, z c: Int) -> Int {
return a + b + c
}
>> sum (x: 10, y: 20, z: 30)
Consistent label behavior for first parameter
Until Swift 2.2
func sum (a: Int, y b: Int, z c: Int) -> Int {
return a + b + c
}
>> sum (10, y: 20, z: 30)
Consistent label behavior for first parameter
Until Swift 2.2
func sum (a: Int, b: Int, c: Int) -> Int {
return a + b + c
}
>> sum (10, b: 20, c: 30)
Consistent label behavior for first parameter
In Swift 3.0
func sum (a: Int, b: Int, c: Int) -> Int {
return a + b + c
}
>> sum (a: 10, b: 20, c: 30)
Consistent label behavior for first parameter
In Swift 3.0 – to save your clients/users from doing extra work
func sum (_ a: Int, b: Int, c: Int) -> Int {
return a + b + c
}
>> sum (10, b: 20, c: 30)
Power of Enums
public enum Video {
case Public(Int, Int, String)
case Private(String)
case Optional(String, Int)
}
Power of Enums
public enum Video {
case Public(Int, Int, String)
case Private(String)
case Optional(String, Int)
}
Power of Enums
extension Video {
func getName() -> String {
switch self {
case let .Public(_, _, s) :
return s
case let .Private(s):
return s
case let .Optional(s, _):
return s
}
}
}
Lower camel case – New API guideline
public enum Video {
case public(Int, Int, String)
case private(String)
case optional(String, Int)
}
public enum Video {
case `public`(Int, Int, String)
case `private`(String)
case `optional`(String, Int)
}
Keywords in member references
extension Video {
func getName() -> String {
switch self {
case let .public(_, _, s) :
return s
case let .private(s):
return s
case let .optional(s, _):
return s
}
}
}
//backticks not needed while referencing member!
Case labels with multiple patterns
extension Video {
func getName() -> String {
switch self {
case let .public(_, _, s),
let .private(s),
let .optional(s, _):
return s
}
}
}
Reversing a triplet
func reverse(t: (Int, Int, Int)) -> (Int, Int, Int) {
return (t.2, t.1, t.0)
}
reverse(t: (1,2,3))
func reverse(t: (Double, Double, Double)) -> (Double,
Double, Double) {
return (t.2, t.1, t.0)
}
reverse(t: (1.1, 2.3, 3.1))
Reversing a triplet
typealias IntTriplet = (Int, Int, Int)
typealias DoubleTriplet = (Double, Double, Double)
func reverse(t: IntTriplet) -> IntTriplet {
return (t.2, t.1, t.0)
}
func reverse(t: DoubleTriplet) -> DoubleTriplet {
return (t.2, t.1, t.0)
}
Generic Typealiases
typealias Triplet<T> = (T, T, T)
func reverse<T>(t: Triplet<T>) -> Triplet<T> {
return (t.2, t.1, t.0)
}
reverse(t: (1,2,3)
reverse(t: (1.1,2.2,3.2)
Generic Type aliases
Will your function reverse function reverse (“swift”, 3.14, 100) ?
How would you do that?
Swift Package Manager
A successful modern language needs an efficient package manager
• A tool for managing distribution of Swift code
• Integrated with the Swift build system
• Downloading, compiling and linking dependencies
• Baby step towards matching CocoaPods & Carthage
Swift Package Manager
• Modules
• Packages
Manifest file
Git based for now
• Products
Library or executable
• Dependencies
Semantic version management
Package.swift
import PackageDescription
let package = Package(
name: ”Reverser",
targets: [],
dependencies: [
.Package(url: "https://github.com/apple/example-package.git",
majorVersion: 1),
]
)
Thank you!
Twitter - @pushkar_nk
GitHub - pushkarnk

More Related Content

What's hot

Swift internals
Swift internalsSwift internals
Swift internalsJung Kim
 
Java 8 lambda expressions
Java 8 lambda expressionsJava 8 lambda expressions
Java 8 lambda expressionsLogan Chien
 
JavaScript 101 - Class 1
JavaScript 101 - Class 1JavaScript 101 - Class 1
JavaScript 101 - Class 1Robert Pearce
 
Programming in Scala: Notes
Programming in Scala: NotesProgramming in Scala: Notes
Programming in Scala: NotesRoberto Casadei
 
Connect.Tech- Swift Memory Management
Connect.Tech- Swift Memory ManagementConnect.Tech- Swift Memory Management
Connect.Tech- Swift Memory Managementstable|kernel
 
Hardened JavaScript
Hardened JavaScriptHardened JavaScript
Hardened JavaScriptKrisKowal2
 
Triggers in plsql
Triggers in plsqlTriggers in plsql
Triggers in plsqlArun Sial
 
Core java concepts
Core java concepts Core java concepts
Core java concepts javeed_mhd
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingHoat Le
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple ProgramsUpender Upr
 
What You Need to Know about Lambdas
What You Need to Know about LambdasWhat You Need to Know about Lambdas
What You Need to Know about LambdasRyan Knight
 
Swift Programming
Swift ProgrammingSwift Programming
Swift ProgrammingCodemotion
 
Javascript Basics
Javascript BasicsJavascript Basics
Javascript Basicsmsemenistyi
 
Java ppt Gandhi Ravi (gandhiri@gmail.com)
Java ppt  Gandhi Ravi  (gandhiri@gmail.com)Java ppt  Gandhi Ravi  (gandhiri@gmail.com)
Java ppt Gandhi Ravi (gandhiri@gmail.com)Gandhi Ravi
 
Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Aaron Gustafson
 
AnyObject – 自分が見落としていた、基本の話
AnyObject – 自分が見落としていた、基本の話AnyObject – 自分が見落としていた、基本の話
AnyObject – 自分が見落としていた、基本の話Tomohiro Kumagai
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript TutorialBui Kiet
 

What's hot (20)

Swift internals
Swift internalsSwift internals
Swift internals
 
Java 8 lambda expressions
Java 8 lambda expressionsJava 8 lambda expressions
Java 8 lambda expressions
 
JavaScript 101 - Class 1
JavaScript 101 - Class 1JavaScript 101 - Class 1
JavaScript 101 - Class 1
 
A Taste of Dotty
A Taste of DottyA Taste of Dotty
A Taste of Dotty
 
Programming in Scala: Notes
Programming in Scala: NotesProgramming in Scala: Notes
Programming in Scala: Notes
 
Connect.Tech- Swift Memory Management
Connect.Tech- Swift Memory ManagementConnect.Tech- Swift Memory Management
Connect.Tech- Swift Memory Management
 
Hardened JavaScript
Hardened JavaScriptHardened JavaScript
Hardened JavaScript
 
Triggers in plsql
Triggers in plsqlTriggers in plsql
Triggers in plsql
 
Core java concepts
Core java concepts Core java concepts
Core java concepts
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction Training
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
What You Need to Know about Lambdas
What You Need to Know about LambdasWhat You Need to Know about Lambdas
What You Need to Know about Lambdas
 
Swift Programming
Swift ProgrammingSwift Programming
Swift Programming
 
Javascript Basics
Javascript BasicsJavascript Basics
Javascript Basics
 
Introduction to Swift
Introduction to SwiftIntroduction to Swift
Introduction to Swift
 
Java ppt Gandhi Ravi (gandhiri@gmail.com)
Java ppt  Gandhi Ravi  (gandhiri@gmail.com)Java ppt  Gandhi Ravi  (gandhiri@gmail.com)
Java ppt Gandhi Ravi (gandhiri@gmail.com)
 
Scala test
Scala testScala test
Scala test
 
Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]
 
AnyObject – 自分が見落としていた、基本の話
AnyObject – 自分が見落としていた、基本の話AnyObject – 自分が見落としていた、基本の話
AnyObject – 自分が見落としていた、基本の話
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript Tutorial
 

Viewers also liked

Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Korhan Bircan
 
ios_summit_2016_korhan
ios_summit_2016_korhanios_summit_2016_korhan
ios_summit_2016_korhanKorhan Bircan
 
Improving apps with iOS 10 notifications (do iOS 2016)
Improving apps with iOS 10 notifications (do iOS 2016)Improving apps with iOS 10 notifications (do iOS 2016)
Improving apps with iOS 10 notifications (do iOS 2016)Donny Wals
 
WWDC 2016
WWDC 2016WWDC 2016
WWDC 2016PiXeL16
 
Core Data with Swift 3.0
Core Data with Swift 3.0Core Data with Swift 3.0
Core Data with Swift 3.0Korhan Bircan
 
WWDC 2016 Personal Recollection
WWDC 2016 Personal RecollectionWWDC 2016 Personal Recollection
WWDC 2016 Personal RecollectionMasayuki Iwai
 
I os swift 3.0 初體驗 &amp; 玩 facebook sdk
I os swift 3.0 初體驗 &amp; 玩 facebook sdkI os swift 3.0 初體驗 &amp; 玩 facebook sdk
I os swift 3.0 初體驗 &amp; 玩 facebook sdk政斌 楊
 
iOS 10 - What you need to know
iOS 10 - What you need to knowiOS 10 - What you need to know
iOS 10 - What you need to knowThe App Business
 
Swift 3 を書くときに知っておきたい API デザインガイドライン #love_swift #akibaswift
Swift 3 を書くときに知っておきたい API デザインガイドライン #love_swift #akibaswiftSwift 3 を書くときに知っておきたい API デザインガイドライン #love_swift #akibaswift
Swift 3 を書くときに知っておきたい API デザインガイドライン #love_swift #akibaswiftTomohiro Kumagai
 

Viewers also liked (12)

Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)
 
Korhan bircan
Korhan bircanKorhan bircan
Korhan bircan
 
ios_summit_2016_korhan
ios_summit_2016_korhanios_summit_2016_korhan
ios_summit_2016_korhan
 
Improving apps with iOS 10 notifications (do iOS 2016)
Improving apps with iOS 10 notifications (do iOS 2016)Improving apps with iOS 10 notifications (do iOS 2016)
Improving apps with iOS 10 notifications (do iOS 2016)
 
WWDC 2016
WWDC 2016WWDC 2016
WWDC 2016
 
Swift 3
Swift   3Swift   3
Swift 3
 
Core Data with Swift 3.0
Core Data with Swift 3.0Core Data with Swift 3.0
Core Data with Swift 3.0
 
iOS 10
iOS 10iOS 10
iOS 10
 
WWDC 2016 Personal Recollection
WWDC 2016 Personal RecollectionWWDC 2016 Personal Recollection
WWDC 2016 Personal Recollection
 
I os swift 3.0 初體驗 &amp; 玩 facebook sdk
I os swift 3.0 初體驗 &amp; 玩 facebook sdkI os swift 3.0 初體驗 &amp; 玩 facebook sdk
I os swift 3.0 初體驗 &amp; 玩 facebook sdk
 
iOS 10 - What you need to know
iOS 10 - What you need to knowiOS 10 - What you need to know
iOS 10 - What you need to know
 
Swift 3 を書くときに知っておきたい API デザインガイドライン #love_swift #akibaswift
Swift 3 を書くときに知っておきたい API デザインガイドライン #love_swift #akibaswiftSwift 3 を書くときに知っておきたい API デザインガイドライン #love_swift #akibaswift
Swift 3 を書くときに知っておきたい API デザインガイドライン #love_swift #akibaswift
 

Similar to Swift Bengaluru Meetup slides

Kotlin boost yourproductivity
Kotlin boost yourproductivityKotlin boost yourproductivity
Kotlin boost yourproductivitynklmish
 
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTechNETFest
 
Functions_21_22.pdf
Functions_21_22.pdfFunctions_21_22.pdf
Functions_21_22.pdfpaijitk
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11Henry Schreiner
 
Functions2.pdf
Functions2.pdfFunctions2.pdf
Functions2.pdfDaddy84
 
Deep Dive Into Swift
Deep Dive Into SwiftDeep Dive Into Swift
Deep Dive Into SwiftSarath C
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoMatt Stine
 
The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210Mahmoud Samir Fayed
 
C sharp 8.0 new features
C sharp 8.0 new featuresC sharp 8.0 new features
C sharp 8.0 new featuresMSDEVMTL
 
C sharp 8.0 new features
C sharp 8.0 new featuresC sharp 8.0 new features
C sharp 8.0 new featuresMiguel Bernard
 
Elegant Solutions For Everyday Python Problems - PyCon Canada 2017
Elegant Solutions For Everyday Python Problems - PyCon Canada 2017Elegant Solutions For Everyday Python Problems - PyCon Canada 2017
Elegant Solutions For Everyday Python Problems - PyCon Canada 2017Nina Zakharenko
 
The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 14 of 185
The Ring programming language version 1.5.4 book - Part 14 of 185The Ring programming language version 1.5.4 book - Part 14 of 185
The Ring programming language version 1.5.4 book - Part 14 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 13 of 212
The Ring programming language version 1.10 book - Part 13 of 212The Ring programming language version 1.10 book - Part 13 of 212
The Ring programming language version 1.10 book - Part 13 of 212Mahmoud Samir Fayed
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()daewon jeong
 
The Ring programming language version 1.8 book - Part 18 of 202
The Ring programming language version 1.8 book - Part 18 of 202The Ring programming language version 1.8 book - Part 18 of 202
The Ring programming language version 1.8 book - Part 18 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 14 of 184
The Ring programming language version 1.5.3 book - Part 14 of 184The Ring programming language version 1.5.3 book - Part 14 of 184
The Ring programming language version 1.5.3 book - Part 14 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196Mahmoud Samir Fayed
 

Similar to Swift Bengaluru Meetup slides (20)

Kotlin boost yourproductivity
Kotlin boost yourproductivityKotlin boost yourproductivity
Kotlin boost yourproductivity
 
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
.NET Fest 2018. Антон Молдован. One year of using F# in production at SBTech
 
Functions_21_22.pdf
Functions_21_22.pdfFunctions_21_22.pdf
Functions_21_22.pdf
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11
 
Functions.pdf
Functions.pdfFunctions.pdf
Functions.pdf
 
Functionscs12 ppt.pdf
Functionscs12 ppt.pdfFunctionscs12 ppt.pdf
Functionscs12 ppt.pdf
 
Functions2.pdf
Functions2.pdfFunctions2.pdf
Functions2.pdf
 
Deep Dive Into Swift
Deep Dive Into SwiftDeep Dive Into Swift
Deep Dive Into Swift
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to Go
 
The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210
 
C sharp 8.0 new features
C sharp 8.0 new featuresC sharp 8.0 new features
C sharp 8.0 new features
 
C sharp 8.0 new features
C sharp 8.0 new featuresC sharp 8.0 new features
C sharp 8.0 new features
 
Elegant Solutions For Everyday Python Problems - PyCon Canada 2017
Elegant Solutions For Everyday Python Problems - PyCon Canada 2017Elegant Solutions For Everyday Python Problems - PyCon Canada 2017
Elegant Solutions For Everyday Python Problems - PyCon Canada 2017
 
The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212
 
The Ring programming language version 1.5.4 book - Part 14 of 185
The Ring programming language version 1.5.4 book - Part 14 of 185The Ring programming language version 1.5.4 book - Part 14 of 185
The Ring programming language version 1.5.4 book - Part 14 of 185
 
The Ring programming language version 1.10 book - Part 13 of 212
The Ring programming language version 1.10 book - Part 13 of 212The Ring programming language version 1.10 book - Part 13 of 212
The Ring programming language version 1.10 book - Part 13 of 212
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()
 
The Ring programming language version 1.8 book - Part 18 of 202
The Ring programming language version 1.8 book - Part 18 of 202The Ring programming language version 1.8 book - Part 18 of 202
The Ring programming language version 1.8 book - Part 18 of 202
 
The Ring programming language version 1.5.3 book - Part 14 of 184
The Ring programming language version 1.5.3 book - Part 14 of 184The Ring programming language version 1.5.3 book - Part 14 of 184
The Ring programming language version 1.5.3 book - Part 14 of 184
 
The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196The Ring programming language version 1.7 book - Part 92 of 196
The Ring programming language version 1.7 book - Part 92 of 196
 

Recently uploaded

Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 

Recently uploaded (20)

Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 

Swift Bengaluru Meetup slides

  • 1. What’s new in Swift 3? Pushkar N Kulkarni | @pushkar_nk | pushkarnk IBM Runtimes IBM India Software Lab
  • 2. Agenda • Swift@IBM - a server-side effort • Language changes in Swift 3.0 (hands-on) • Swift Package Manager (hands-on)
  • 3. Swift@IBM • Swift on Linux – swift.org • IBM Swift Package Catalog • Kitura • IBM Swift Sandbox Blog: https://developer.ibm.com/swift/blogs/
  • 5. IBM Swift Package Catalog • https://swiftpkgs.ng.bluemix.net/ • Find, explore and share packages from the open-source Swift ecosystem • Explore dependencies • Submit your own packages 5
  • 6. Kitura Web Framework What is it? • New, modular, package-based web framework written in Swift Why is this cool? • Empower a new generation of native mobile developers to write and deploy code into the Cloud. Developer Benefits ? • Delivers core technologies needed to stand up enterprise apps on the server • Enables developers to create a web application in Swift and deploy these servers on Linux and the Cloud. http://github.com/ibm-swift/kitura 6
  • 7. IBM Swift Sandbox • Interactive sandbox for rapid prototyping and experimentation in Swift • Saves your work • Supports multiple versions of Swift • Responsive design 7 https://swiftlang.ng.bluemix.net/
  • 8. Swift 3.0 • Major release • Not source-compatible with Swift 2.2 • Fundamental changes to the language and standard library • Swift package manager – Linux & Darwin
  • 9. Language changes • Removal of C-style for-loops • Removal of increment/decrement operators • New function to find first element passing a predicate • Consistent label behavior for first parameter
  • 10. Language changes • New API guidelines • Keywords in member references • Case labels with multiple patterns • Generic type-aliasing
  • 11. C-Style code (Swift 2.2) func arithmeticSeries(a: Int, d: Int, n: Int) -> [Int] { var series: [Int] = [] for var i = 0; i < n; i++ { series += [a + i*d] } return series } arithmeticSeries(1, d: 3, n: 10)
  • 12. C-style constructs removed //this works on all Swift versions func arithmeticSeries(a: Int, d: Int, n: Int) -> [Int] { var series: [Int] = [] for i in 0..<n { series += [a+i*d] } return series } print(arithmeticSeries(1, d: 3, n: 10))
  • 13. Sequence iteration - stdlib func arithmeticSeries(a: Int, d: Int, n: Int) -> [Int] { var series: [Int] = [] for x in sequence(first: a, next: {$0+d}).prefix(n){ series += [x] } return series } print(arithmeticSeries(a: 1, d: 3, n: 10))
  • 14. Sequence.first(where:) Finding the first element that satisfies a predicate let series = arithmeticSeries(a: 1, d: 3, n: 10) //first double digit element series.first(where: {$0 > 9})
  • 15. Consistent label behavior for first parameter Until Swift 2.2 func sum (x a: Int, y b: Int, z c: Int) -> Int { return a + b + c } >> sum (x: 10, y: 20, z: 30)
  • 16. Consistent label behavior for first parameter Until Swift 2.2 func sum (a: Int, y b: Int, z c: Int) -> Int { return a + b + c } >> sum (10, y: 20, z: 30)
  • 17. Consistent label behavior for first parameter Until Swift 2.2 func sum (a: Int, b: Int, c: Int) -> Int { return a + b + c } >> sum (10, b: 20, c: 30)
  • 18. Consistent label behavior for first parameter In Swift 3.0 func sum (a: Int, b: Int, c: Int) -> Int { return a + b + c } >> sum (a: 10, b: 20, c: 30)
  • 19. Consistent label behavior for first parameter In Swift 3.0 – to save your clients/users from doing extra work func sum (_ a: Int, b: Int, c: Int) -> Int { return a + b + c } >> sum (10, b: 20, c: 30)
  • 20. Power of Enums public enum Video { case Public(Int, Int, String) case Private(String) case Optional(String, Int) }
  • 21. Power of Enums public enum Video { case Public(Int, Int, String) case Private(String) case Optional(String, Int) }
  • 22. Power of Enums extension Video { func getName() -> String { switch self { case let .Public(_, _, s) : return s case let .Private(s): return s case let .Optional(s, _): return s } } }
  • 23. Lower camel case – New API guideline public enum Video { case public(Int, Int, String) case private(String) case optional(String, Int) } public enum Video { case `public`(Int, Int, String) case `private`(String) case `optional`(String, Int) }
  • 24. Keywords in member references extension Video { func getName() -> String { switch self { case let .public(_, _, s) : return s case let .private(s): return s case let .optional(s, _): return s } } } //backticks not needed while referencing member!
  • 25. Case labels with multiple patterns extension Video { func getName() -> String { switch self { case let .public(_, _, s), let .private(s), let .optional(s, _): return s } } }
  • 26. Reversing a triplet func reverse(t: (Int, Int, Int)) -> (Int, Int, Int) { return (t.2, t.1, t.0) } reverse(t: (1,2,3)) func reverse(t: (Double, Double, Double)) -> (Double, Double, Double) { return (t.2, t.1, t.0) } reverse(t: (1.1, 2.3, 3.1))
  • 27. Reversing a triplet typealias IntTriplet = (Int, Int, Int) typealias DoubleTriplet = (Double, Double, Double) func reverse(t: IntTriplet) -> IntTriplet { return (t.2, t.1, t.0) } func reverse(t: DoubleTriplet) -> DoubleTriplet { return (t.2, t.1, t.0) }
  • 28. Generic Typealiases typealias Triplet<T> = (T, T, T) func reverse<T>(t: Triplet<T>) -> Triplet<T> { return (t.2, t.1, t.0) } reverse(t: (1,2,3) reverse(t: (1.1,2.2,3.2)
  • 29. Generic Type aliases Will your function reverse function reverse (“swift”, 3.14, 100) ? How would you do that?
  • 30. Swift Package Manager A successful modern language needs an efficient package manager • A tool for managing distribution of Swift code • Integrated with the Swift build system • Downloading, compiling and linking dependencies • Baby step towards matching CocoaPods & Carthage
  • 31. Swift Package Manager • Modules • Packages Manifest file Git based for now • Products Library or executable • Dependencies Semantic version management
  • 32. Package.swift import PackageDescription let package = Package( name: ”Reverser", targets: [], dependencies: [ .Package(url: "https://github.com/apple/example-package.git", majorVersion: 1), ] )
  • 33. Thank you! Twitter - @pushkar_nk GitHub - pushkarnk

Editor's Notes

  1. What is it ? Kitura is a new, modular, package-based web framework written in the Swift language for use in standing up a web server written in Swift on both OSX and Linux. Why is this cool ? Now that Swift is open source, a number of included projects are coming together (swift, swift package manager, libdispatch, swift foundation) that makes the development of a Swift-based web server stack both inevitable as well as incredibly valuable means to empower a new generation of native mobile developers to write and deploy code into the Cloud as well. Developer Benefits ? Once you have a new language that runs on a server, many developers want to be able to quickly and easily create a web server written in that language. The swift language and runtime does not include a web framework that can be used to easily create a web server. IBM has created this project to enable developers to create a web application in Swift and deploy these servers on Linux and the Cloud. IBM Message We are leading the development of this web framework and will work with the community to evolve this framework over time as Swift on Linux evolves. Other Details