SlideShare uma empresa Scribd logo
1 de 45
Baixar para ler offline
letswift(16)
스위프트 3.0
Swift는 어디로 가는가
OSXDEV.org박세현
Agenda
Swift 역사
Swift 3.0 훑어보기
Swift Evolution & 구현
Swift History
2010년 7월 Swift 개발 시작
2014년 6월 2일 WWDC 앱 Swift로 작성된 공개 앱.
2014년 9월 9일 Swift 1.0 마일스톤
2014년 10월 22일 Swift 1.1
2015년 4월 8일 Swift 1.2
2015년 WWDC Swift 2.0 발표
2015년 12월 3일 Swift 오픈소스 발표, 3.0 로드맵 발표
Swift 1.2
성능향상
if-let 개선(바인딩)
as 키워드로 업캐스팅/다운캐스팅
Set 추가
Objective-C 옵셔널 수식어 추가
Swift 2.0
에러처리 throw, do try catch
guard let ­ else
프로토콜 익스텐션
Objective-C 제네릭
Swift 3.0
예상 발표일: 2016 말
Swift 언어와 개발 경험 강화
Swift 3.0과 이후 버전의 소스 호환성
http://bekher.net/2015/06/the-next-step-for-swift/
Swift 3.0 Focus
API 디자인 가이드라인
임포트한 Obj-C API에 네이밍 가이드라인 자동 적용
핵심 API에 네이밍 가이드라인 도입
임포트한 Obj-C API의 Swift화
언어의 집중 및 정교화
툴 품질 향상
API Design Guideline
기본 원칙
사용 시점의 명확성
짧은 것보다 명확한 것이 더 중요
모든 선언마다 주석으로 문서화
Swift Evolution
Language Evolution Process
Socialize ➔ Proposal(PR) ➔ Review ➔ Decision
Swift Evolution Process
https://swift.org/community/#mailing-lists
https://lists.swift.org/mailman/listinfo/swift-evolution
https://github.com/apple/swift-
evolution#implemented-proposals-for-swift-3
Swift Evolution: Example
SE-0031: Adjusting inout Declarations for Type
Decoration
메일링 리스트 논의
PR
SE 수락
SE-0031
Adjusting 'inout' Declarations for Type
Decoration
Swift 2
Swift 3
(x: inout T) -> U // => (inout T) -> U
func foo(inOut x: T) // foo(inOut:), type (T) -> Void
func foo(inout x: T) // foo(_:), type (inout T) -> Void
letswift(16)
Core Language
Swift 3 Removals
SE-0002: Removing currying func declaration syntax
SE-0003: Removing var from Function Parameters
SE-0004: Remove the ++ and -- operators
SE-0007: Remove C-style for-loops with conditions and
incrementers
SE-0029: Remove implicit tuple splat behavior from function
applications
SE-0053: Remove explicit use of let from Function Parameters
SE-0003:
Removing var from Function Parameters
func foo(i: Int) {
i += 1 // illegal
}
func foo(var i: Int) {
i += 1 // OK, but the caller cannot observe this mutation.
}
func doSomethingWithVar(var i: Int) {
i = 2 // This will NOT have an effect on the
caller's Int that was passed, but it can be modified
locally
}
func doSomethingWithInout(inout i: Int) {
i = 2 // This will have an effect on the caller's
Int that was passed.
}
var x = 1
print(x) // 1
doSomethingWithVar(x)
print(x) // 1
doSomethingWithInout(&x)
print(x) // 2
SE-0003:
기존 코드
func foo(i: Int) {
var i = i
}
Swift 3 Functions
SE-0042: Flattening the function type of unapplied method references
SE-0046: Establish consistent label behavior across all parameters
including first labels
SE-0047: Defaulting non-Void functions so they warn on unused
results
SE-0066: Standardize function type argument syntax to require
parentheses
SE-0110: Distinguish between single-tuple and multiple-argument
function types
SE-0111: Remove type system significance of function argument labels
SE-0046
Establish consistent label behavior across all
parameters including first labels
Swift 2
Swift 3
func foo(a: T, b: U, c: V)
foo(_:b:c:)
func foo(a: T, b: U, c: V)
foo(a:b:c:)
func foo(_: T, b: U, c: V)
foo(_:b:c:)
SE-0110
Distinguish between single-tuple and multiple-
argument function types
Swift 2
Swift 3
let fn1 : (Int, Int) -> Void = { x in
// The type of x is the tuple (Int, Int).
// ...
}
let fn2 : (Int, Int) -> Void = { x, y in
// The type of x is Int, the type of y is Int.
// ...
}
let a : ((Int, Int, Int)) -> Int = { x in return x.0 + x.1 + x.2 }
Swift 3 Optional
SE-0008: Add a Lazy flatMap for Sequences of
Optionals
SE-0054: Abolish ImplicitlyUnwrappedOptional
type
SE-0055: Make unsafe pointer nullability explicit
using Optional
Swift 3 Debugging & Testing
SE-0019: Swift Testing
SE-0028: Modernizing Swift's Debugging
Identifiers (__FILE__, etc)
SE-0034: Disambiguating Line Control
Statements from Debugging Identifiers
SE-0039: Modernizing Playground Literals
Modernizing Swift's Debugging Identifiers
Swift offers built-in __FILE__, __LINE__, __COLUMN__,
__FUNCTION__, and __DSO_HANDLE__ identifiers
__FILE__ ➔ #file
__LINE__ ➔ #line
__COLUMN__ ➔ #column
__FUNCTION__ ➔ #function (Added during review)
__DSO_HANDLE__ ➔ #dsohandle
SE-0028
Swift 3 Swift Library
SE-0016: Adding initializers to Int and UInt to convert
from UnsafePointer and UnsafeMutablePointer
SE-0032: Add first(where:) method to SequenceType
SE-0052: Change IteratorType post-nil guarantee
SE-0065: A New Model For Collections and Indices
SE-0094: Add sequence(first:next:) and
sequence(state:next:) to the stdlib
letswift(16)
API & Foundation
Swift 3 API Design Guidelines
Swift API Design Guidelines
SE-0005: Better Translation of Objective-C APIs Into
Swift
SE-0006: Apply API Guidelines to the Standard
Library
SE-0023: API Design Guidelines
SE-0059: Update API Naming Guidelines and Rewrite
Set APIs Accordingly
SE-0005
Better Translation of Objective-C APIs Into Swift
Objective-C API
Swifty version
let content = listItemView.text.stringByTrimmingCharactersInSet(
NSCharacterSet.whitespaceAndNewlineCharacterSet())
let content = listItemView.text.trimming(.whitespaceAndNewlines)
SE-0005
UIBezierPath in Swift 2
class UIBezierPath : NSObject, NSCopying, NSCoding {
convenience init(ovalInRect: CGRect)
func moveToPoint(_: CGPoint)
func addLineToPoint(_: CGPoint)
func addCurveToPoint(_: CGPoint, controlPoint1: CGPoint, controlPoint2: CGPoint)
func addQuadCurveToPoint(_: CGPoint, controlPoint: CGPoint)
func appendPath(_: UIBezierPath)
func bezierPathByReversingPath() -> UIBezierPath
func applyTransform(_: CGAffineTransform)
var empty: Bool { get }
func containsPoint(_: CGPoint) -> Bool
func fillWithBlendMode(_: CGBlendMode, alpha: CGFloat)
func strokeWithBlendMode(_: CGBlendMode, alpha: CGFloat)
func copyWithZone(_: NSZone) -> AnyObject
func encodeWithCoder(_: NSCoder)
}
SE-0005
UIBezierPath in Swift 3
class UIBezierPath : NSObject, NSCopying, NSCoding {
convenience init(ovalIn rect: CGRect)
func move(to point: CGPoint)
func addLine(to point: CGPoint)
func addCurve(to endPoint: CGPoint, controlPoint1 controlPoint1: CGPoint,
controlPoint2 controlPoint2: CGPoint)
func addQuadCurve(to endPoint: CGPoint, controlPoint controlPoint: CGPoint)
func append(_ bezierPath: UIBezierPath)
func reversing() -> UIBezierPath
func apply(_ transform: CGAffineTransform)
var isEmpty: Bool { get }
func contains(_ point: CGPoint) -> Bool
func fill(_ blendMode: CGBlendMode, alpha alpha: CGFloat)
func stroke(_ blendMode: CGBlendMode, alpha alpha: CGFloat)
func copy(with zone: NSZone = nil) -> AnyObject
func encode(with aCoder: NSCoder)
}
SE-0006
Strip Type Suffix from protocol names
-public protocol BooleanType { ... }
+public protocol Boolean { ... }
-public protocol SequenceType { ... }
+public protocol Sequence { ... }
-public protocol CollectionType : ... { ... }
+public protocol Collection : ... { ... }
-public protocol MutableCollectionType : ... { ... }
+public protocol MutableCollection : ... { ... }
-public protocol RangeReplaceableCollectionType : ... { ... }
+public protocol RangeReplaceableCollection : ... { ... }
-public protocol AnyCollectionType : ... { ... }
+public protocol AnyCollectionProtocol : ... { ... }
-public protocol IntegerType : ... { ... }
+public protocol Integer : ... { ... }
SE-0006
renamed functions
sort() ➔ sorted()
sortInPlace() ➔ sort()
reverse() ➔ reversed()
enumerate() ➔ enumerated()
SE-0006
New importing rules
extension String {
- public static func localizedNameOfStringEncoding(
- encoding: NSStringEncoding
- ) -> String
+ public static func localizedName(
+ ofStringEncoding encoding: NSStringEncoding
+ ) -> String
- public static func pathWithComponents(components: [String]) -> String
+ public static func path(withComponents components: [String]) -> String
- public init?(UTF8String bytes: UnsafePointer<CChar>)
+ public init?(utf8String bytes: UnsafePointer<CChar>)
- public func canBeConvertedToEncoding(encoding: NSStringEncoding) -> Bool
+ public func canBeConverted(toEncoding encoding: NSStringEncoding) -> Bool
- public var capitalizedString: String
+ public var capitalized: String
- public var localizedCapitalizedString: String
+ public var localizedCapitalized: String
Swift 3 Foundation
SE-0069: Mutability and Foundation Value
Types
SE-0086: Drop NS Prefix in Swift Foundation
SE-0069
Mutability and Foundation Value Types
Objective-C API
let myDate = Date()
let myLaterDate = myDate.dateByAddingTimeInterval(60)
var myDate = Date()
myDate.addTimeInterval(60) // OK
let myOtherDate = Date()
myOtherDate.addTimeInterval(60) // Error, as expected
SE-0086
Drop NS Prefix in Swift Foundation
Objective-C Name Swift Name
NSAttributedString AttributedString
NSBlockOperation BlockOperation
NSBundle Bundle
NSByteCountFormatter ByteCountFormatter
NSCache Cache
NSCacheDelegate CacheDelegate
NSCachedURLResponse CachedURLResponse
NSCalendar Calendar
NSComparisonPredicate ComparisonPredicate
NSComparisonResult ComparisonResult
NSCompoundPredicate CompoundPredicate
SE-0086
Enumerations
extension DateIntervalFormatter {
@available(OSX 10.10, iOS 8.0, *)
public enum Style : UInt {
case none
case short
case medium
case long
case full
}
}
extension NumberFormatter {
public enum Style : UInt {
case none
case decimal
case currency
case percent
case scientific
case spellOut
@available(OSX 10.11, iOS 9.0, *)
case ordinal
@available(OSX 10.11, iOS 9.0, *)
case currencyISOCode
@available(OSX 10.11, iOS 9.0, *)
case currencyPlural
@available(OSX 10.11, iOS 9.0, *)
case currencyAccounting
}
}
Swift 3 Objective-C
SE-0062: Referencing Objective-C key-paths
SE-0064: Referencing the Objective-C selector of
property getters and setters
SE-0070: Make Optional Requirements Objective-C-
only
SE-0033: Import Objective-C Constants as Swift
Types
SE-0057: Importing Objective-C Lightweight Generics
References
https://en.wikipedia.org/wiki/
Swift_(programming_language)
https://swift.org/documentation/api-design-guidelines/
https://developer.apple.com/videos/play/wwdc2016/402/
https://developer.apple.com/videos/play/wwdc2016/207/
https://github.com/apple/swift-evolution#implemented-
proposals-for-swift-3
https://www.raywenderlich.com/135655/whats-new-swift-3
–Johnny Appleseed
“Swift 3 is awesome.”
letswift(16)

Mais conteúdo relacionado

Mais procurados

Reactive Access to MongoDB from Scala
Reactive Access to MongoDB from ScalaReactive Access to MongoDB from Scala
Reactive Access to MongoDB from ScalaHermann Hueck
 
RxSwift 활용하기 - Let'Swift 2017
RxSwift 활용하기 - Let'Swift 2017RxSwift 활용하기 - Let'Swift 2017
RxSwift 활용하기 - Let'Swift 2017Wanbok Choi
 
Hardened JavaScript
Hardened JavaScriptHardened JavaScript
Hardened JavaScriptKrisKowal2
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to JavascriptAnjan Banda
 
Swift Bengaluru Meetup slides
Swift Bengaluru Meetup slidesSwift Bengaluru Meetup slides
Swift Bengaluru Meetup slidesPushkar Kulkarni
 
Javascript Basics
Javascript BasicsJavascript Basics
Javascript Basicsmsemenistyi
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionDmitry Sheiko
 
Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Anton Arhipov
 
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMConcurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMMario Fusco
 
JavaScript Functions
JavaScript FunctionsJavaScript Functions
JavaScript FunctionsColin DeCarlo
 
Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2José Paumard
 
ES6 PPT FOR 2016
ES6 PPT FOR 2016ES6 PPT FOR 2016
ES6 PPT FOR 2016Manoj Kumar
 
OOP and FP - Become a Better Programmer
OOP and FP - Become a Better ProgrammerOOP and FP - Become a Better Programmer
OOP and FP - Become a Better ProgrammerMario Fusco
 

Mais procurados (20)

Java Cheat Sheet
Java Cheat SheetJava Cheat Sheet
Java Cheat Sheet
 
Reactive Access to MongoDB from Scala
Reactive Access to MongoDB from ScalaReactive Access to MongoDB from Scala
Reactive Access to MongoDB from Scala
 
RxSwift 활용하기 - Let'Swift 2017
RxSwift 활용하기 - Let'Swift 2017RxSwift 활용하기 - Let'Swift 2017
RxSwift 활용하기 - Let'Swift 2017
 
Sailing with Java 8 Streams
Sailing with Java 8 StreamsSailing with Java 8 Streams
Sailing with Java 8 Streams
 
What's new in Swift 3
What's new in Swift 3What's new in Swift 3
What's new in Swift 3
 
Hardened JavaScript
Hardened JavaScriptHardened JavaScript
Hardened JavaScript
 
ES6 in Real Life
ES6 in Real LifeES6 in Real Life
ES6 in Real Life
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
 
Swift Bengaluru Meetup slides
Swift Bengaluru Meetup slidesSwift Bengaluru Meetup slides
Swift Bengaluru Meetup slides
 
Javascript Basics
Javascript BasicsJavascript Basics
Javascript Basics
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012
 
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STMConcurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
 
Scala coated JVM
Scala coated JVMScala coated JVM
Scala coated JVM
 
A Taste of Dotty
A Taste of DottyA Taste of Dotty
A Taste of Dotty
 
Pragmatic sbt
Pragmatic sbtPragmatic sbt
Pragmatic sbt
 
JavaScript Functions
JavaScript FunctionsJavaScript Functions
JavaScript Functions
 
Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2Lambdas and Streams Master Class Part 2
Lambdas and Streams Master Class Part 2
 
ES6 PPT FOR 2016
ES6 PPT FOR 2016ES6 PPT FOR 2016
ES6 PPT FOR 2016
 
OOP and FP - Become a Better Programmer
OOP and FP - Become a Better ProgrammerOOP and FP - Become a Better Programmer
OOP and FP - Become a Better Programmer
 

Destaque

안드로이드 개발자를 위한 스위프트
안드로이드 개발자를 위한 스위프트안드로이드 개발자를 위한 스위프트
안드로이드 개발자를 위한 스위프트병한 유
 
Swift and Xcode8
Swift and Xcode8Swift and Xcode8
Swift and Xcode8Hyuk Hur
 
Swift server-side-let swift2016
Swift server-side-let swift2016Swift server-side-let swift2016
Swift server-side-let swift2016Eric Ahn
 
Do swift: Swift 무작정 해보기
Do swift: Swift 무작정 해보기Do swift: Swift 무작정 해보기
Do swift: Swift 무작정 해보기YoonBong Steve Kim
 
Swift package manager
Swift package managerSwift package manager
Swift package manager성관 윤
 
스위프트 성능 이해하기
스위프트 성능 이해하기스위프트 성능 이해하기
스위프트 성능 이해하기Yongha Yoo
 
Protocol Oriented Programming in Swift
Protocol Oriented Programming in SwiftProtocol Oriented Programming in Swift
Protocol Oriented Programming in SwiftSeongGyu Jo
 

Destaque (7)

안드로이드 개발자를 위한 스위프트
안드로이드 개발자를 위한 스위프트안드로이드 개발자를 위한 스위프트
안드로이드 개발자를 위한 스위프트
 
Swift and Xcode8
Swift and Xcode8Swift and Xcode8
Swift and Xcode8
 
Swift server-side-let swift2016
Swift server-side-let swift2016Swift server-side-let swift2016
Swift server-side-let swift2016
 
Do swift: Swift 무작정 해보기
Do swift: Swift 무작정 해보기Do swift: Swift 무작정 해보기
Do swift: Swift 무작정 해보기
 
Swift package manager
Swift package managerSwift package manager
Swift package manager
 
스위프트 성능 이해하기
스위프트 성능 이해하기스위프트 성능 이해하기
스위프트 성능 이해하기
 
Protocol Oriented Programming in Swift
Protocol Oriented Programming in SwiftProtocol Oriented Programming in Swift
Protocol Oriented Programming in Swift
 

Semelhante a Letswift Swift 3.0

The Swift Compiler and Standard Library
The Swift Compiler and Standard LibraryThe Swift Compiler and Standard Library
The Swift Compiler and Standard LibrarySantosh Rajan
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_netNico Ludwig
 
.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
 
Compiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | InterpretersCompiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | InterpretersEelco Visser
 
Intro to Retrofit 2 and RxJava2
Intro to Retrofit 2 and RxJava2Intro to Retrofit 2 and RxJava2
Intro to Retrofit 2 and RxJava2Fabio Collini
 
Web Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfWeb Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfSamHoney6
 
(2) c sharp introduction_basics_part_i
(2) c sharp introduction_basics_part_i(2) c sharp introduction_basics_part_i
(2) c sharp introduction_basics_part_iNico Ludwig
 
Server Side Swift
Server Side SwiftServer Side Swift
Server Side SwiftChad Moone
 
Firebird 3: provider-based architecture, plugins and OO approach to API
Firebird 3: provider-based architecture, plugins and OO approach to API Firebird 3: provider-based architecture, plugins and OO approach to API
Firebird 3: provider-based architecture, plugins and OO approach to API Mind The Firebird
 
Introduction to c_plus_plus
Introduction to c_plus_plusIntroduction to c_plus_plus
Introduction to c_plus_plusSayed Ahmed
 
Introduction to c_plus_plus (6)
Introduction to c_plus_plus (6)Introduction to c_plus_plus (6)
Introduction to c_plus_plus (6)Sayed Ahmed
 
Tips and Tricks for Swift & Dot Swift 2016
Tips and Tricks for Swift & Dot Swift 2016Tips and Tricks for Swift & Dot Swift 2016
Tips and Tricks for Swift & Dot Swift 2016Adam Gask
 
Swift LA Meetup at eHarmony- What's New in Swift 2.0
Swift LA Meetup at eHarmony- What's New in Swift 2.0Swift LA Meetup at eHarmony- What's New in Swift 2.0
Swift LA Meetup at eHarmony- What's New in Swift 2.0Claire Townend Gee
 
Object oriented programming system with C++
Object oriented programming system with C++Object oriented programming system with C++
Object oriented programming system with C++msharshitha03s
 
掀起 Swift 的面紗
掀起 Swift 的面紗掀起 Swift 的面紗
掀起 Swift 的面紗Pofat Tseng
 
Eclipse Training - Main eclipse ecosystem classes
Eclipse Training - Main eclipse ecosystem classesEclipse Training - Main eclipse ecosystem classes
Eclipse Training - Main eclipse ecosystem classesLuca D'Onofrio
 
Ice mini guide
Ice mini guideIce mini guide
Ice mini guideAdy Liu
 
Web2py Code Lab
Web2py Code LabWeb2py Code Lab
Web2py Code LabColin Su
 

Semelhante a Letswift Swift 3.0 (20)

The Swift Compiler and Standard Library
The Swift Compiler and Standard LibraryThe Swift Compiler and Standard Library
The Swift Compiler and Standard Library
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net
 
.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
 
Compiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | InterpretersCompiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | Interpreters
 
F# And Silverlight
F# And SilverlightF# And Silverlight
F# And Silverlight
 
Intro to Retrofit 2 and RxJava2
Intro to Retrofit 2 and RxJava2Intro to Retrofit 2 and RxJava2
Intro to Retrofit 2 and RxJava2
 
Web Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfWeb Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdf
 
(2) c sharp introduction_basics_part_i
(2) c sharp introduction_basics_part_i(2) c sharp introduction_basics_part_i
(2) c sharp introduction_basics_part_i
 
Server Side Swift
Server Side SwiftServer Side Swift
Server Side Swift
 
What is your money doing?
What is your money doing?What is your money doing?
What is your money doing?
 
Firebird 3: provider-based architecture, plugins and OO approach to API
Firebird 3: provider-based architecture, plugins and OO approach to API Firebird 3: provider-based architecture, plugins and OO approach to API
Firebird 3: provider-based architecture, plugins and OO approach to API
 
Introduction to c_plus_plus
Introduction to c_plus_plusIntroduction to c_plus_plus
Introduction to c_plus_plus
 
Introduction to c_plus_plus (6)
Introduction to c_plus_plus (6)Introduction to c_plus_plus (6)
Introduction to c_plus_plus (6)
 
Tips and Tricks for Swift & Dot Swift 2016
Tips and Tricks for Swift & Dot Swift 2016Tips and Tricks for Swift & Dot Swift 2016
Tips and Tricks for Swift & Dot Swift 2016
 
Swift LA Meetup at eHarmony- What's New in Swift 2.0
Swift LA Meetup at eHarmony- What's New in Swift 2.0Swift LA Meetup at eHarmony- What's New in Swift 2.0
Swift LA Meetup at eHarmony- What's New in Swift 2.0
 
Object oriented programming system with C++
Object oriented programming system with C++Object oriented programming system with C++
Object oriented programming system with C++
 
掀起 Swift 的面紗
掀起 Swift 的面紗掀起 Swift 的面紗
掀起 Swift 的面紗
 
Eclipse Training - Main eclipse ecosystem classes
Eclipse Training - Main eclipse ecosystem classesEclipse Training - Main eclipse ecosystem classes
Eclipse Training - Main eclipse ecosystem classes
 
Ice mini guide
Ice mini guideIce mini guide
Ice mini guide
 
Web2py Code Lab
Web2py Code LabWeb2py Code Lab
Web2py Code Lab
 

Último

Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 

Último (20)

Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 

Letswift Swift 3.0

  • 1. letswift(16) 스위프트 3.0 Swift는 어디로 가는가 OSXDEV.org박세현
  • 2. Agenda Swift 역사 Swift 3.0 훑어보기 Swift Evolution & 구현
  • 3. Swift History 2010년 7월 Swift 개발 시작 2014년 6월 2일 WWDC 앱 Swift로 작성된 공개 앱. 2014년 9월 9일 Swift 1.0 마일스톤 2014년 10월 22일 Swift 1.1 2015년 4월 8일 Swift 1.2 2015년 WWDC Swift 2.0 발표 2015년 12월 3일 Swift 오픈소스 발표, 3.0 로드맵 발표
  • 4. Swift 1.2 성능향상 if-let 개선(바인딩) as 키워드로 업캐스팅/다운캐스팅 Set 추가 Objective-C 옵셔널 수식어 추가
  • 5. Swift 2.0 에러처리 throw, do try catch guard let ­ else 프로토콜 익스텐션 Objective-C 제네릭
  • 6. Swift 3.0 예상 발표일: 2016 말 Swift 언어와 개발 경험 강화 Swift 3.0과 이후 버전의 소스 호환성 http://bekher.net/2015/06/the-next-step-for-swift/
  • 7. Swift 3.0 Focus API 디자인 가이드라인 임포트한 Obj-C API에 네이밍 가이드라인 자동 적용 핵심 API에 네이밍 가이드라인 도입 임포트한 Obj-C API의 Swift화 언어의 집중 및 정교화 툴 품질 향상
  • 8.
  • 9. API Design Guideline 기본 원칙 사용 시점의 명확성 짧은 것보다 명확한 것이 더 중요 모든 선언마다 주석으로 문서화
  • 10. Swift Evolution Language Evolution Process Socialize ➔ Proposal(PR) ➔ Review ➔ Decision Swift Evolution Process https://swift.org/community/#mailing-lists https://lists.swift.org/mailman/listinfo/swift-evolution https://github.com/apple/swift- evolution#implemented-proposals-for-swift-3
  • 11.
  • 12.
  • 13. Swift Evolution: Example SE-0031: Adjusting inout Declarations for Type Decoration 메일링 리스트 논의 PR SE 수락
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. SE-0031 Adjusting 'inout' Declarations for Type Decoration Swift 2 Swift 3 (x: inout T) -> U // => (inout T) -> U func foo(inOut x: T) // foo(inOut:), type (T) -> Void func foo(inout x: T) // foo(_:), type (inout T) -> Void
  • 20. Swift 3 Removals SE-0002: Removing currying func declaration syntax SE-0003: Removing var from Function Parameters SE-0004: Remove the ++ and -- operators SE-0007: Remove C-style for-loops with conditions and incrementers SE-0029: Remove implicit tuple splat behavior from function applications SE-0053: Remove explicit use of let from Function Parameters
  • 21. SE-0003: Removing var from Function Parameters func foo(i: Int) { i += 1 // illegal } func foo(var i: Int) { i += 1 // OK, but the caller cannot observe this mutation. } func doSomethingWithVar(var i: Int) { i = 2 // This will NOT have an effect on the caller's Int that was passed, but it can be modified locally } func doSomethingWithInout(inout i: Int) { i = 2 // This will have an effect on the caller's Int that was passed. } var x = 1 print(x) // 1 doSomethingWithVar(x) print(x) // 1 doSomethingWithInout(&x) print(x) // 2
  • 23. Swift 3 Functions SE-0042: Flattening the function type of unapplied method references SE-0046: Establish consistent label behavior across all parameters including first labels SE-0047: Defaulting non-Void functions so they warn on unused results SE-0066: Standardize function type argument syntax to require parentheses SE-0110: Distinguish between single-tuple and multiple-argument function types SE-0111: Remove type system significance of function argument labels
  • 24. SE-0046 Establish consistent label behavior across all parameters including first labels Swift 2 Swift 3 func foo(a: T, b: U, c: V) foo(_:b:c:) func foo(a: T, b: U, c: V) foo(a:b:c:) func foo(_: T, b: U, c: V) foo(_:b:c:)
  • 25. SE-0110 Distinguish between single-tuple and multiple- argument function types Swift 2 Swift 3 let fn1 : (Int, Int) -> Void = { x in // The type of x is the tuple (Int, Int). // ... } let fn2 : (Int, Int) -> Void = { x, y in // The type of x is Int, the type of y is Int. // ... } let a : ((Int, Int, Int)) -> Int = { x in return x.0 + x.1 + x.2 }
  • 26. Swift 3 Optional SE-0008: Add a Lazy flatMap for Sequences of Optionals SE-0054: Abolish ImplicitlyUnwrappedOptional type SE-0055: Make unsafe pointer nullability explicit using Optional
  • 27. Swift 3 Debugging & Testing SE-0019: Swift Testing SE-0028: Modernizing Swift's Debugging Identifiers (__FILE__, etc) SE-0034: Disambiguating Line Control Statements from Debugging Identifiers SE-0039: Modernizing Playground Literals
  • 28. Modernizing Swift's Debugging Identifiers Swift offers built-in __FILE__, __LINE__, __COLUMN__, __FUNCTION__, and __DSO_HANDLE__ identifiers __FILE__ ➔ #file __LINE__ ➔ #line __COLUMN__ ➔ #column __FUNCTION__ ➔ #function (Added during review) __DSO_HANDLE__ ➔ #dsohandle SE-0028
  • 29. Swift 3 Swift Library SE-0016: Adding initializers to Int and UInt to convert from UnsafePointer and UnsafeMutablePointer SE-0032: Add first(where:) method to SequenceType SE-0052: Change IteratorType post-nil guarantee SE-0065: A New Model For Collections and Indices SE-0094: Add sequence(first:next:) and sequence(state:next:) to the stdlib
  • 31. Swift 3 API Design Guidelines Swift API Design Guidelines SE-0005: Better Translation of Objective-C APIs Into Swift SE-0006: Apply API Guidelines to the Standard Library SE-0023: API Design Guidelines SE-0059: Update API Naming Guidelines and Rewrite Set APIs Accordingly
  • 32. SE-0005 Better Translation of Objective-C APIs Into Swift Objective-C API Swifty version let content = listItemView.text.stringByTrimmingCharactersInSet( NSCharacterSet.whitespaceAndNewlineCharacterSet()) let content = listItemView.text.trimming(.whitespaceAndNewlines)
  • 33. SE-0005 UIBezierPath in Swift 2 class UIBezierPath : NSObject, NSCopying, NSCoding { convenience init(ovalInRect: CGRect) func moveToPoint(_: CGPoint) func addLineToPoint(_: CGPoint) func addCurveToPoint(_: CGPoint, controlPoint1: CGPoint, controlPoint2: CGPoint) func addQuadCurveToPoint(_: CGPoint, controlPoint: CGPoint) func appendPath(_: UIBezierPath) func bezierPathByReversingPath() -> UIBezierPath func applyTransform(_: CGAffineTransform) var empty: Bool { get } func containsPoint(_: CGPoint) -> Bool func fillWithBlendMode(_: CGBlendMode, alpha: CGFloat) func strokeWithBlendMode(_: CGBlendMode, alpha: CGFloat) func copyWithZone(_: NSZone) -> AnyObject func encodeWithCoder(_: NSCoder) }
  • 34. SE-0005 UIBezierPath in Swift 3 class UIBezierPath : NSObject, NSCopying, NSCoding { convenience init(ovalIn rect: CGRect) func move(to point: CGPoint) func addLine(to point: CGPoint) func addCurve(to endPoint: CGPoint, controlPoint1 controlPoint1: CGPoint, controlPoint2 controlPoint2: CGPoint) func addQuadCurve(to endPoint: CGPoint, controlPoint controlPoint: CGPoint) func append(_ bezierPath: UIBezierPath) func reversing() -> UIBezierPath func apply(_ transform: CGAffineTransform) var isEmpty: Bool { get } func contains(_ point: CGPoint) -> Bool func fill(_ blendMode: CGBlendMode, alpha alpha: CGFloat) func stroke(_ blendMode: CGBlendMode, alpha alpha: CGFloat) func copy(with zone: NSZone = nil) -> AnyObject func encode(with aCoder: NSCoder) }
  • 35. SE-0006 Strip Type Suffix from protocol names -public protocol BooleanType { ... } +public protocol Boolean { ... } -public protocol SequenceType { ... } +public protocol Sequence { ... } -public protocol CollectionType : ... { ... } +public protocol Collection : ... { ... } -public protocol MutableCollectionType : ... { ... } +public protocol MutableCollection : ... { ... } -public protocol RangeReplaceableCollectionType : ... { ... } +public protocol RangeReplaceableCollection : ... { ... } -public protocol AnyCollectionType : ... { ... } +public protocol AnyCollectionProtocol : ... { ... } -public protocol IntegerType : ... { ... } +public protocol Integer : ... { ... }
  • 36. SE-0006 renamed functions sort() ➔ sorted() sortInPlace() ➔ sort() reverse() ➔ reversed() enumerate() ➔ enumerated()
  • 37. SE-0006 New importing rules extension String { - public static func localizedNameOfStringEncoding( - encoding: NSStringEncoding - ) -> String + public static func localizedName( + ofStringEncoding encoding: NSStringEncoding + ) -> String - public static func pathWithComponents(components: [String]) -> String + public static func path(withComponents components: [String]) -> String - public init?(UTF8String bytes: UnsafePointer<CChar>) + public init?(utf8String bytes: UnsafePointer<CChar>) - public func canBeConvertedToEncoding(encoding: NSStringEncoding) -> Bool + public func canBeConverted(toEncoding encoding: NSStringEncoding) -> Bool - public var capitalizedString: String + public var capitalized: String - public var localizedCapitalizedString: String + public var localizedCapitalized: String
  • 38. Swift 3 Foundation SE-0069: Mutability and Foundation Value Types SE-0086: Drop NS Prefix in Swift Foundation
  • 39. SE-0069 Mutability and Foundation Value Types Objective-C API let myDate = Date() let myLaterDate = myDate.dateByAddingTimeInterval(60) var myDate = Date() myDate.addTimeInterval(60) // OK let myOtherDate = Date() myOtherDate.addTimeInterval(60) // Error, as expected
  • 40. SE-0086 Drop NS Prefix in Swift Foundation Objective-C Name Swift Name NSAttributedString AttributedString NSBlockOperation BlockOperation NSBundle Bundle NSByteCountFormatter ByteCountFormatter NSCache Cache NSCacheDelegate CacheDelegate NSCachedURLResponse CachedURLResponse NSCalendar Calendar NSComparisonPredicate ComparisonPredicate NSComparisonResult ComparisonResult NSCompoundPredicate CompoundPredicate
  • 41. SE-0086 Enumerations extension DateIntervalFormatter { @available(OSX 10.10, iOS 8.0, *) public enum Style : UInt { case none case short case medium case long case full } } extension NumberFormatter { public enum Style : UInt { case none case decimal case currency case percent case scientific case spellOut @available(OSX 10.11, iOS 9.0, *) case ordinal @available(OSX 10.11, iOS 9.0, *) case currencyISOCode @available(OSX 10.11, iOS 9.0, *) case currencyPlural @available(OSX 10.11, iOS 9.0, *) case currencyAccounting } }
  • 42. Swift 3 Objective-C SE-0062: Referencing Objective-C key-paths SE-0064: Referencing the Objective-C selector of property getters and setters SE-0070: Make Optional Requirements Objective-C- only SE-0033: Import Objective-C Constants as Swift Types SE-0057: Importing Objective-C Lightweight Generics