what’s new in swift · 2.5x more swift code 15% less code to rewrite the same functionality in...
TRANSCRIPT
![Page 1: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/1.jpg)
© 2016 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.
Developer Tools #WWDC16
Session 402
What’s New in Swift
Ted KremenekChris LattnerEwa Matejska
![Page 2: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/2.jpg)
Goals for Swift 3
![Page 3: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/3.jpg)
Goals for Swift 3
Develop an open community
![Page 4: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/4.jpg)
Goals for Swift 3
Develop an open communityPortability to new platforms
![Page 5: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/5.jpg)
Goals for Swift 3
Develop an open communityPortability to new platformsGet the fundamentals right
![Page 6: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/6.jpg)
Goals for Swift 3
Develop an open communityPortability to new platformsGet the fundamentals rightOptimize for awesomeness
![Page 7: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/7.jpg)
![Page 8: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/8.jpg)
Swift Adoption at Apple
![Page 9: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/9.jpg)
Swift Adoption at Apple
![Page 10: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/10.jpg)
Agents and DaemonsMusic Console
![Page 11: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/11.jpg)
![Page 12: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/12.jpg)
![Page 13: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/13.jpg)
Dock
![Page 14: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/14.jpg)
Dock
Mission Control LaunchPad
Dashboard
Spaces
Accelerated Two Up
Command-Tab Application Switcher
Dock Bar at Bottom
Some of Notification System
Stacks
![Page 15: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/15.jpg)
What Changed from El Capitan to Sierra?
Most of Mission Control completely rewritten in SwiftAccessibility engine completely rewritten in Swift
![Page 16: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/16.jpg)
Lines of codeProject Evolution
![Page 17: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/17.jpg)
Lines of codeProject Evolution
Dock is ~200,000 lines of code
![Page 18: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/18.jpg)
Lines of codeProject Evolution
Dock is ~200,000 lines of code2.5x more Swift code
![Page 19: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/19.jpg)
Lines of codeProject Evolution
Dock is ~200,000 lines of code2.5x more Swift code15% less code to rewrite the same functionality in Swift
![Page 20: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/20.jpg)
Lines of codeProject Evolution
Dock is ~200,000 lines of code2.5x more Swift code15% less code to rewrite the same functionality in SwiftNew features were added at the same time
![Page 21: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/21.jpg)
swift.org
![Page 22: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/22.jpg)
![Page 23: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/23.jpg)
![Page 24: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/24.jpg)
Swift Open Source
Open evolution processNon-Apple contributors with direct commit accessCode of conductApache 2 with Runtime Library Exception
![Page 25: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/25.jpg)
Downloadable Toolchains
Download toolchains as Swift develops!• Xcode (Apple platforms) and Linux• Built by continuous integration system
Playground support in Xcode 8 (coming soon)
![Page 26: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/26.jpg)
![Page 27: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/27.jpg)
Swift.org Projects on
![Page 28: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/28.jpg)
Swift.org Projects on
swift swift-llbuild
swift-clang
swift-llvm
swift-corelibs-foundation
swift-corelibs-xctest
swift-package-manager
swift-lldb
swift-corelibs-libdispatch
swift-evolution
![Page 29: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/29.jpg)
swift
swift-package-manager
swift-llbuildswift-lldb
swift-clang
swift-llvm
swift-corelibs-foundation
swift-corelibs-libdispatch
swift-corelibs-xctest
swift-evolution
![Page 30: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/30.jpg)
swift
swift-package-managerswift-llbuild
swift-corelibs-foundationswift-corelibs-libdispatch
swift-corelibs-xctest
swift-evolution
Core LibrariesPackage Manager
Language
![Page 31: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/31.jpg)
Swift Package Manager
swift-package-managerswift-llbuild
Package Manager
![Page 32: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/32.jpg)
Swift Package Manager
swift-package-managerswift-llbuild
Package ManagerEarly and actively in development
![Page 33: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/33.jpg)
Swift Package Manager
Early and actively in developmentCross-platform packages
![Page 34: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/34.jpg)
Swift Package Manager
Early and actively in developmentCross-platform packagesDesigned for frictionless development
![Page 35: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/35.jpg)
Swift Package Manager
Early and actively in developmentCross-platform packagesDesigned for frictionless developmentGreat Xcode integration in the future
![Page 36: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/36.jpg)
swift
swift-package-managerswift-llbuild
swift-corelibs-foundationswift-corelibs-libdispatch
swift-corelibs-xctest
swift-evolution
Package Manager
Language
Core Libraries
![Page 37: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/37.jpg)
swift
swift-package-managerswift-llbuild
swift-evolution
Package Manager
Language
Core Libraries
![Page 38: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/38.jpg)
swift
swift-package-managerswift-llbuild
swift-evolution
Package Manager
Language
Core Libraries
swift-corelibs-foundationswift-corelibs-libdispatch
swift-corelibs-xctest
![Page 39: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/39.jpg)
Foundation on Linux
![Page 40: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/40.jpg)
Foundation on Linux
AffineTransform
Decimal
PersonNameComponents
URLDate
DateComponents
Measurement
URLQueryItem
IndexSetIndexPath
URLRequest
CharacterSet
Data
DateInterval
Notification URLComponents
UUID
![Page 41: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/41.jpg)
swiftswift-evolution
swift-package-managerswift-llbuild
swift-corelibs-foundationswift-corelibs-libdispatch
swift-corelibs-xctest
Package Manager
Language
Core Libraries
![Page 42: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/42.jpg)
swiftswift-evolution
Language
![Page 43: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/43.jpg)
swiftswift-evolution
Language
![Page 44: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/44.jpg)
swift-evolution
![Page 45: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/45.jpg)
Language Evolution Process
![Page 46: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/46.jpg)
Language Evolution Process
Socialize change on mailing list
![Page 47: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/47.jpg)
Language Evolution Process
Socialize change on mailing listProposal submitted as a pull request
SE-0046
![Page 48: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/48.jpg)
Language Evolution Process
Socialize change on mailing listProposal submitted as a pull requestPull request accepted to start review
![Page 49: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/49.jpg)
Language Evolution Process
Socialize change on mailing listProposal submitted as a pull requestPull request accepted to start reviewFormal review on mailing lists
![Page 50: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/50.jpg)
Language Evolution Process
Socialize change on mailing listProposal submitted as a pull requestPull request accepted to start reviewFormal review on mailing listsCore team arbitrates a decision
![Page 51: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/51.jpg)
![Page 52: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/52.jpg)
Language and Experience
Chris Lattner
![Page 53: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/53.jpg)
Making the Core Experience Great
Improve overall experienceof writing Swift code• Swift language• Standard library• Cocoa in Swift• Tools
![Page 54: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/54.jpg)
Primary goal of Swift 3Zeroing in on Source Compatibility
Source compatibility is the most popular “feature” requestEspecially critical for cross-platformSource compatibility between Swift 3 and 4 is a very strong goal*
![Page 55: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/55.jpg)
Primary goal of Swift 3Zeroing in on Source Compatibility
Source compatibility is the most popular “feature” requestEspecially critical for cross-platformSource compatibility between Swift 3 and 4 is a very strong goal*
* But not an absolute promise
![Page 56: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/56.jpg)
API Naming
![Page 57: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/57.jpg)
Carefully studied what is important in API design• Strive for clarity—not terseness or verbosity• Capture essential information• Omit redundant information/boilerplate
Naming Guidelines
SE-0023 SE-0005 SE-0006
![Page 58: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/58.jpg)
Carefully studied what is important in API design• Strive for clarity—not terseness or verbosity• Capture essential information• Omit redundant information/boilerplate
Naming Guidelines
SE-0023 SE-0005 SE-0006
https://swift.org/documentation/api-design-guidelines/
![Page 59: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/59.jpg)
Example API Changes
Swift.Array
array.append array.insert(1, atIndex: 0)
[2,3,4])(ontentsOfC
![Page 60: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/60.jpg)
Example API Changes
Swift.Array
Foundation.NSURL
array.append array.insert(1, atIndex: 0)
[2,3,4])(ontentsOfC
if url. x = url.
ileURL {}fURLByAppendingPathComponent("file.txt")
![Page 61: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/61.jpg)
Example API Changes
Swift.Array
Foundation.NSURL
[2,3,4])array.append array.insert(1, atIndex: 0)
( ontentsOfc
if url. x = url.
ileURL {}fURLByAppendingPathComponent("file.txt")
:
![Page 62: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/62.jpg)
Example API Changes
Swift.Array
Foundation.NSURL
[2,3,4])array.append array.insert(1, at: 0)
( ontentsOfc
if url. x = url.
ileURL {}fURLByAppendingPathComponent("file.txt")
:
![Page 63: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/63.jpg)
Example API Changes
Swift.Array
Foundation.NSURL
[2,3,4])array.append array.insert(1, at: 0)
( ontentsOfc
if url. x = url.
ileURL {}isFURLByAppendingPathComponent("file.txt")
:
![Page 64: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/64.jpg)
Example API Changes
Swift.Array
Foundation.NSURL
[2,3,4])array.append array.insert(1, at: 0)
( ontentsOfc
if url. x = url.
ileURL {}isFappendingPathComponent("file.txt")
:
![Page 65: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/65.jpg)
Example API Changes
Swift.Array
Foundation.NSURL
Swift API Design Guidelines Presidio Tuesday 10:00AM
[2,3,4])array.append array.insert(1, at: 0)
( ontentsOfc
if url. x = url.
ileURL {}isFappendingPathComponent("file.txt")
:
![Page 66: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/66.jpg)
Importing Objective-C APIs
![Page 67: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/67.jpg)
Import as Membervoid CGContextFillPath(CGContextRef)
SE-0044
;
![Page 68: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/68.jpg)
Import as Membervoid CGContextFillPath(CGContextRef)
func CGContextFillPath(_: CGContext)
Swift 2
SE-0044
;
![Page 69: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/69.jpg)
Import as Membervoid CGContextFillPath(CGContextRef)
func CGContextFillPath(_: CGContext) extension CGContext { func fillPath() }
NS_SWIFT_NAME(CGContext.fillPath(self:));
Swift API Design Guidelines Presidio Tuesday 10:00AM
Swift 2 Swift 3
SE-0044
![Page 70: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/70.jpg)
Objective-C Generics
SE-0057
func findAnimals() { let request = NSFetchRequest(entityName:”Animal") guard let searchResults = try? context.executeFetchRequest(request) as! [Animal] { return } ... use(searchResults) }
![Page 71: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/71.jpg)
SE-0057
Objective-C Generics
func findAnimals() { let request : NSFetchRequest<Animal> = Animal.fetchRequest guard let searchResults = try? context.fetch(request) {
return } ... use(searchResults) }
![Page 72: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/72.jpg)
Typed Objective-C ConstantsStringly
typedef NSString *NSNotificationName; const NSNotificationName NSUserDefaultsDidChangeNotification;
SE-0033
![Page 73: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/73.jpg)
D
Typed Objective-C Constants
Imported definitionUserDefaults idChangeNotification: Stringlet NS
Stringly
typedef NSString *NSNotificationName; const NSNotificationName NSUserDefaultsDidChangeNotification;
SE-0033
![Page 74: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/74.jpg)
idChangeNotificationUserDefaults
D
D
Typed Objective-C Constants
center.addObserver(forName:
Imported definitionUserDefaults idChangeNotification: Stringlet NS
, …)NS
Stringly
typedef NSString *NSNotificationName; const NSNotificationName NSUserDefaultsDidChangeNotification;
Use
SE-0033
![Page 75: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/75.jpg)
idChangeNotificationUserDefaultsD
Typed Objective-C Constants
center.addObserver(forName:
Imported definitionUserDefaults idChangeNotification: Stringlet NS
, …)NS
Stringly
typedef NSString *NSNotificationName; const NSNotificationName NSUserDefaultsDidChangeNotification;
NS_EXTENSIBLE_STRING_ENUM;
Use
d
SE-0033
![Page 76: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/76.jpg)
NSNotification.Nameextension { UserDefaults
idChangeNotificationd :let}class
Typed Objective-C ConstantsStringly
typedef NSString *NSNotificationName; const NSNotificationName NSUserDefaultsDidChangeNotification;
NS_EXTENSIBLE_STRING_ENUM;
idChangeNotificationUserDefaultsD center.addObserver(forName: , …)NS
Imported definition
Use
SE-0033
![Page 77: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/77.jpg)
NSNotification.Nameextension { UserDefaults
idChangeNotificationd :let}class
Typed Objective-C ConstantsStringly
typedef NSString *NSNotificationName; const NSNotificationName NSUserDefaultsDidChangeNotification;
NS_EXTENSIBLE_STRING_ENUM;
idChangeNotificationUserDefaultsdcenter.addObserver(forName: , …)NS
Imported definition
Use
SE-0033
![Page 78: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/78.jpg)
Typed Objective-C Constants
center.addObserver(forName: , …)UserDefaults idChangeNotificationd.
Stringly
NSNotification.Nameextension { UserDefaults
idChangeNotificationd :let}class
typedef NSString *NSNotificationName; const NSNotificationName NSUserDefaultsDidChangeNotification;
NS_EXTENSIBLE_STRING_ENUM;
Imported definition
Use
SE-0033
![Page 79: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/79.jpg)
Typed Objective-C Constants
center.addObserver(forName: , …)UserDefaults idChangeNotificationd
Strongly
.
NSNotification.Nameextension { UserDefaults
idChangeNotificationd :let}class
typedef NSString *NSNotificationName; const NSNotificationName NSUserDefaultsDidChangeNotification;
NS_EXTENSIBLE_STRING_ENUM;
Imported definition
Use
SE-0033
![Page 80: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/80.jpg)
Improvements Throughout the SDK
Major work on Foundation, Dispatch, and Core Graphics
Countless smaller improvements• Ongoing nullability audit • Adoption of Objective-C generics• And more…
![Page 81: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/81.jpg)
Improvements Throughout the SDK
Major work on Foundation, Dispatch, and Core Graphics
Countless smaller improvements• Ongoing nullability audit • Adoption of Objective-C generics• And more…
What’s New in Foundation for Swift Mission Tuesday 4:00PM
Concurrent Programming with GCD in Swift 3 Pacific Heights Friday 4:00PM
![Page 82: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/82.jpg)
Core Language
![Page 83: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/83.jpg)
Consistent Parameter Labeling
func myFunction(a: Int, b: Int, c: Int) { }
SE-0046
![Page 84: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/84.jpg)
Consistent Parameter Labeling
Swift 2
myFunction(
func myFunction(a: Int, b: Int, c: Int) { }
42, b: 57, c: 99)
SE-0046
![Page 85: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/85.jpg)
Consistent Parameter Labeling
Swift 3
myFunction(
func myFunction(a: Int, b: Int, c: Int) { }
a: 42, b: 57, c: 99)
SE-0046
![Page 86: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/86.jpg)
Simpler and more consistentAPI naming often encourages first parameter labelAny parameter label may be suppressed with _
Consistent Parameter Labeling
Swift 3
myFunction(
func myFunction(a: Int, b: Int, c: Int) { }
a: 42, b: 57, c: 99)
SE-0046
![Page 87: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/87.jpg)
Move ‘where’ Clause to End of Declaration
func anyCommon<T: Sequence, U: Sequence >(lhs: T, rhs: U) -> Bool {
SE-0081
COMING SOON!
![Page 88: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/88.jpg)
Move ‘where’ Clause to End of Declaration
where T.Element: Equatable, T.Element == U.Element
func anyCommon<T: Sequence, U: Sequence
>(lhs: T, rhs: U) -> Bool {
SE-0081
COMING SOON!
![Page 89: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/89.jpg)
Move ‘where’ Clause to End of Declaration
where T.Element: Equatable, T.Element == U.Element
Swift 2
func anyCommon<T: Sequence, U: Sequence
>(lhs: T, rhs: U) -> Bool {
SE-0081
COMING SOON!
![Page 90: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/90.jpg)
Move ‘where’ Clause to End of Declaration
where T.Element: Equatable, T.Element == U.Element
func anyCommon<T: Sequence, U: Sequence>(lhs: T, rhs: U) -> Bool{where T.Element: Equatable, T.Element == U.Element
Swift 3
Swift 2
func anyCommon<T: Sequence, U: Sequence
>(lhs: T, rhs: U) -> Bool {
SE-0081
COMING SOON!
![Page 91: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/91.jpg)
Warn on Unused Results by Default
func plusOne(_ a: Int) -> Int {
plusOne(x)
return a+1 }
SE-0047
![Page 92: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/92.jpg)
Warn on Unused Results by Default
func plusOne(_ a: Int) -> Int {
plusOne(x)
return a+1 }
Result of call to ‘plusOne’ is unused
SE-0047
![Page 93: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/93.jpg)
Warn on Unused Results by Default
func plusOne(_ a: Int) -> Int {
plusOne(x)
return a+1 }
print(a) // side effect!
Result of call to ‘plusOne’ is unused
SE-0047
![Page 94: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/94.jpg)
Warn on Unused Results by Default
func plusOne(_ a: Int) -> Int {
plusOne(x)_ = plusOne(x)
return a+1 }
print(a) // side effect!
Result of call to ‘plusOne’ is unused
SE-0047
![Page 95: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/95.jpg)
Warn on Unused Results by Default
func plusOne(_ a: Int) -> Int {
plusOne(x)_ = plusOne(x)
return a+1 }
print(a) // side effect!
@discardableResult
SE-0047
![Page 96: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/96.jpg)
Features Removed in Swift 3
![Page 97: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/97.jpg)
Features Removed in Swift 3
![Page 98: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/98.jpg)
Features Removed in Swift 3Focus and simplify the languageReduce language complexityTeaching and learning
![Page 99: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/99.jpg)
Features Removed in Swift 3Focus and simplify the languageReduce language complexityTeaching and learning
SE-0002 Currying func declaration syntax
SE-0003 var in function parameter lists
SE-0004 ++ and -- operators
SE-0007 C-style for loop
SE-0029 Implicit tuple splat in calls
What got removed?
![Page 100: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/100.jpg)
Other small enhancementsCore Language
![Page 101: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/101.jpg)
Other small enhancementsCore Language
![Page 102: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/102.jpg)
Other small enhancementsCore Language COMING
SOON!
SE-0025 Scoped access level, new fileprivate access level
SE-0043 case labels with multiple variable bindings
SE-0048 Generic Type Aliases
SE-0062 Referencing Objective-C key-paths
SE-0064 Referencing the selector for property getters and setters
SE-0068 Expanding Self to class members and value types
SE-0075 Adding a build configuration “is importable” test
SE-0092 Typealiases in protocols and protocol extensions
![Page 103: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/103.jpg)
Core LanguageSyntactic cleanups
![Page 104: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/104.jpg)
Core LanguageSyntactic cleanups
![Page 105: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/105.jpg)
Core LanguageSyntactic cleanups
SE-0028 Replace __FILE__ with #file
SE-0031 inout moved to be part of the type
SE-0036 Requiring leading dot prefixes for enum instance members
SE-0040 Attribute syntax: replace = with :
SE-0049 Move @noescape and @autoclosure to be type attributes
SE-0060 Enforcing order of defaulted parameters
SE-0066 Standardize function type argument syntax to require parentheses
SE-0096 Converting dynamicType from a property to an operator
![Page 106: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/106.jpg)
Type System
![Page 107: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/107.jpg)
Type System Purpose
Type system and type checker work together• Validate correctness of code• Infer types and overloads implicit in code let a = x + y
![Page 108: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/108.jpg)
Type System Purpose
Type system and type checker work together• Validate correctness of code• Infer types and overloads implicit in code let a = x + yGoal• Simpler, more consistent, and more predictable type system• Remove “gotchas” and surprising behavior• Improve type checker performance
![Page 109: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/109.jpg)
UnsafePointer Nullability
let ptr : UnsafeMutablePointer<Int>
Swift
= nil
if ptr != nil {ptr
}.memory = 42
2
SE-0055
![Page 110: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/110.jpg)
UnsafePointer Nullability
let ptr : UnsafeMutablePointer<Int>
Swift
= nil
if let ptr = ptr {ptr
}.memory = 42
3
?
SE-0055
![Page 111: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/111.jpg)
UnsafePointer Nullability
Imported C pointers in APIs obey _Nullable and _Null_unspecifiedConsistency: nil is dedicated to Optional and ImplicitlyUnwrappedOptional
let ptr : UnsafeMutablePointer<Int> = nil
ptr .memory = 42
?
Swift 3
SE-0002
![Page 112: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/112.jpg)
UnsafePointer Nullability
Imported C pointers in APIs obey _Nullable and _Null_unspecifiedConsistency: nil is dedicated to Optional and ImplicitlyUnwrappedOptional
let ptr : UnsafeMutablePointer<Int> = nil
ptr .memory = 42
?
?
Swift 3
SE-0002
![Page 113: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/113.jpg)
Implicitly Unwrapped Optional (IUO)func f(value : Int!) {
}
Swift 2
SE-0054
![Page 114: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/114.jpg)
Implicitly Unwrapped Optional (IUO)func f(value : Int!) {
}
Swift 2
let x = value + 1 let y = value
SE-0054
![Page 115: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/115.jpg)
Implicitly Unwrapped Optional (IUO)func f(value : Int!) {
}
Swift 2
let x = value + 1 let y = value
SE-0054
// x: Int - force unwrapped// y: Int!
![Page 116: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/116.jpg)
Implicitly Unwrapped Optional (IUO)func f(value : Int!) {
}
let array = [value, 42]
use(array)
// [Int], [Int!], [Int?], [Any]...
Swift 2
let x = value + 1 let y = value
SE-0054
// x: Int - force unwrapped// y: Int!
![Page 117: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/117.jpg)
Implicitly Unwrapped Optional (IUO)func f(value : Int!) {
}
let array = [value, 42]
use(array) Cannot convert value of type ‘[Int!]’ to argument type !
// [Int], [Int!], [Int?], [Any]...
Swift 2
let x = value + 1 let y = value
SE-0054
// x: Int - force unwrapped// y: Int!
![Page 118: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/118.jpg)
Implicitly Unwrapped Optional (IUO)
“IUO” becomes a strong optional if that will work• It is only forced if necessary to type check
func f(value : Int!) {
}
let array = [value, 42]
use(array)
Swift 3
let x = value + 1 let y = value
SE-0054
![Page 119: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/119.jpg)
Implicitly Unwrapped Optional (IUO)
“IUO” becomes a strong optional if that will work• It is only forced if necessary to type check
func f(value : Int!) {
}
let array = [value, 42]
use(array)
Swift 3
let x = value + 1 let y = value
// x: Int - force unwrapped
SE-0054
![Page 120: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/120.jpg)
Implicitly Unwrapped Optional (IUO)
“IUO” becomes a strong optional if that will work• It is only forced if necessary to type check
func f(value : Int!) {
}
let array = [value, 42]
use(array)
Swift 3
let x = value + 1 let y = value // y: Int?
// x: Int - force unwrapped
SE-0054
![Page 121: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/121.jpg)
Implicitly Unwrapped Optional (IUO)
“IUO” becomes a strong optional if that will work• It is only forced if necessary to type check
func f(value : Int!) {
}
let array = [value, 42]
use(array)
Swift 3
// [Int?]
let x = value + 1 let y = value // y: Int?
// x: Int - force unwrapped
SE-0054
![Page 122: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/122.jpg)
Implicitly Unwrapped Optional (IUO)
“IUO” becomes a strong optional if that will work• It is only forced if necessary to type check
func f(value : Int!) {
}
let array = [value, 42]
use(array)
Swift 3
// [Int?]
let x = value + 1 let y = value // y: Int?
// x: Int - force unwrapped
SE-0054
// [Int]let array2 = [value!, 42]
![Page 123: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/123.jpg)
Standard Library
![Page 124: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/124.jpg)
Collections move their indicesNew Collection Indexing Model
i = collection.startIndex
next = i.successor()
Swift 2
SE-0065
![Page 125: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/125.jpg)
Collections move their indicesNew Collection Indexing Model
i = collection.startIndex
next = i.successor()
Swift 2
i = collection.startIndex
next = collection.index(after: i)
Swift 3
SE-0065
![Page 126: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/126.jpg)
Collections move their indicesNew Collection Indexing Model
i = collection.startIndex
next = i.successor()
Benefits• HalfOpenInterval and IntervalType are merged into Range• 0...UInt8.max now works properly• Better performance
Swift 2
i = collection.startIndex
next = collection.index(after: i)
Swift 3
SE-0065
![Page 127: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/127.jpg)
Floating Point and Numerics
New FloatingPoint protocol unifies Float, Double, Float80, and CGFloat• Provides core IEEE-754 properties and operations • Permits algorithms to be generic over all floating point types
SE-0067
![Page 128: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/128.jpg)
Floating Point and Numerics
New FloatingPoint protocol unifies Float, Double, Float80, and CGFloat• Provides core IEEE-754 properties and operations • Permits algorithms to be generic over all floating point types
let v = 2 * Float(M_PI)
Swift 2 Swift 3
let v = 2 * Float.pi
SE-0067
![Page 129: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/129.jpg)
return x *
Floating Point and Numerics
New FloatingPoint protocol unifies Float, Double, Float80, and CGFloat• Provides core IEEE-754 properties and operations • Permits algorithms to be generic over all floating point types
let v = 2 * Float(M_PI)
Swift 2 Swift 3
let v = 2 * Float.pi
return x * CGFloat(M_PI) / 180 CGFloat.pi / 180
SE-0067
![Page 130: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/130.jpg)
return x *
Floating Point and Numerics
New FloatingPoint protocol unifies Float, Double, Float80, and CGFloat• Provides core IEEE-754 properties and operations • Permits algorithms to be generic over all floating point types
let v = 2 * Float(M_PI)
Swift 2 Swift 3
let v = 2 * Float.pi
return x * CGFloat(M_PI) / 180 .pi / 180
SE-0067
![Page 131: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/131.jpg)
Other small enhancementsStandard Library
![Page 132: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/132.jpg)
Other small enhancementsStandard Library
SE-0008 Add a Lazy flatMap for sequences of optionals
SE-0016 Conversions Unsafe[Mutable]Pointer to Int and UInt
SE-0017 Change Unmanaged to use UnsafePointer
SE-0032 Add first(where:) method to Sequence
SE-0061 Add generic result and error handling to autoreleasepool()
SE-0080 Failable numeric conversion initializers
SE-0093 Adding a public base property to slices
SE-0094 Add sequence(first:next:) and sequence(state:next:) to the stdlib
![Page 133: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/133.jpg)
Swift 3 Language and Experience
API namingImporting Objective-C APIsCore languageType systemStandard library
![Page 134: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/134.jpg)
Swift Tools
Ewa Matejska
![Page 135: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/135.jpg)
Smaller Binaries
Faster Type Checking
String Hashing
Incremental Compilation Stack Promotion
Faster Dictionary
Whole Module Optimization
Faster Startup Time
![Page 136: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/136.jpg)
Dictionary<String, T>
3x
![Page 137: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/137.jpg)
Heap to Stack Promotion for Classes
24x
![Page 138: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/138.jpg)
String Algorithm Optimizations
86x
![Page 139: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/139.jpg)
Whole Module Optimization
![Page 140: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/140.jpg)
Whole Module Optimization
File1.swift
File2.swift
File3.swift
Compiler
Compiler
Compiler
File1.o
File2.o
File3.o
![Page 141: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/141.jpg)
Whole Module Optimization
File1.swift
File2.swift
File3.swift
Compiler
Compiler
Compiler
File1.o
File2.o
File3.o
![Page 142: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/142.jpg)
Whole Module Optimization
File1.swift
File2.swift
File3.swift
Compiler File2.o
![Page 143: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/143.jpg)
Whole Module Optimization
File1.swift
File2.swift
File3.swift
Compiler Module.o
![Page 144: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/144.jpg)
WMO on by Default for New Projects
![Page 145: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/145.jpg)
What About Compile Time?
File2.swift
File1.swift
File3.swift
Compiler Module.o
![Page 146: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/146.jpg)
What About Compile Time?
File2.swift
File1.swift
File3.swift
Compiler Module.o
![Page 147: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/147.jpg)
What About Compile Time?
File2.swift
File1.swift
File3.swift
Compiler Module.o
![Page 148: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/148.jpg)
Code Size Optimization
DemoBots
AlamoFire
Code Size—Swift 3 vs. Swift 2.20.25 0.5 0.75 1
95%
77%
![Page 149: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/149.jpg)
Xcode
![Page 150: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/150.jpg)
Synthesized Interfaces
//: Playground - noun: a place where people can play
let exampleArray = Array<Int>() exampleArray.sort()
![Page 151: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/151.jpg)
Synthesized Interfaces
/// An ordered, random-access collection. /// ... extension MutableCollectionType where Self.Generator.Element : Comparable {
/// Returns an `Array` containing the sorted elements of `source`. /// ... @warn_unused_result(mutable_variant="sortInPlace") public func sort() -> [Self.Generator.Element] }
/// ...
![Page 152: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/152.jpg)
Flattening Protocols into APIs
/// An ordered, random-access collection. /// … extension Array where Element : Comparable {
/// Returns the elements of the collection, sorted. /// … public func sorted() -> [Element]
/// … }
![Page 153: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/153.jpg)
Grouping by Logical Area
/// An ordered, random-access collection. /// … extension Array where Element : Comparable {
/// Returns the elements of the collection, sorted. /// … public func sorted() -> [Element]
/// … }
![Page 154: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/154.jpg)
![Page 155: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/155.jpg)
![Page 156: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/156.jpg)
Migrating from Swift 2.2
![Page 157: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/157.jpg)
Migrating from Swift 2.2
![Page 158: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/158.jpg)
What Is Swift 2.3?
Swift 2.2
+ =
Swift 2.3New SDKs
![Page 159: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/159.jpg)
What Is Swift 2.3?
![Page 160: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/160.jpg)
What Is Swift 2.3?
Build, test, and submit to App Store fully supported
![Page 161: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/161.jpg)
What Is Swift 2.3?
Build, test, and submit to App Store fully supported
Playgrounds and documentation depend on Swift 3
![Page 162: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/162.jpg)
What Is Swift 2.3?
Build, test, and submit to App Store fully supported
Interim solution until you migrate to Swift 3
Playgrounds and documentation depend on Swift 3
![Page 163: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/163.jpg)
Working with Swift 2.2 and Swift 2.3
var groupBackgroundImage: UIImage {
UIGraphicsBeginImageContextWithOptions(groupBackgroundImageSize, false, 2.0)
drawCompleteItemsCountInCurrentContext()
let frame = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return frame
}
SE-0020
![Page 164: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/164.jpg)
Working with Swift 2.2 and Swift 2.3
var groupBackgroundImage: UIImage {
UIGraphicsBeginImageContextWithOptions(groupBackgroundImageSize, false, 2.0)
drawCompleteItemsCountInCurrentContext()
let frame = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return frame
}
!
SE-0020
![Page 165: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/165.jpg)
Working with Swift 2.2 and Swift 2.3
var groupBackgroundImage: UIImage {
UIGraphicsBeginImageContextWithOptions(groupBackgroundImageSize, false, 2.0)
drawCompleteItemsCountInCurrentContext()
let frame = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return frame
}
#if swift(>=2.3)
#else
return frame
#endif
!
SE-0020
![Page 166: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/166.jpg)
From Swift 2.3 to Swift 3
![Page 167: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/167.jpg)
Summary
Swift 3 focuses on fundamentalsSee swift.org for how to get involvedMigrator available to Swift 3
![Page 168: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/168.jpg)
More Information
https://developer.apple.com/wwdc16/402
![Page 169: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/169.jpg)
Related Sessions
Swift API Design Guidelines Presidio Tuesday 10:00AM
Getting Started with Swift Pacific Heights Tuesday 1:40PM
What’s New in Foundation for Swift Mission Tuesday 4:00PM
Introducing Swift Playgrounds Mission Wednesday 11:00AM
Going Server-Side with Swift Open Source Mission Friday 9:00AM
Understanding Swift Performance Mission Friday 11:00AM
Concurrent Programming with GCD in Swift 3 Pacific Heights Friday 4:00PM
![Page 170: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/170.jpg)
Subtitle
Swift Open Hours Developer Tools Lab A Tuesday 12:00PM
Swift Open Hours Developer Tools Lab A Tuesday 3:00PM
Swift Open Hours Developer Tools Lab A Wednesday 9:00AM
Swift Open Hours Developer Tools Lab A Wednesday 12:00PM
Swift Open Hours Developer Tools Lab A Wednesday 3:00PM
Swift Open Hours Developer Tools Lab A Thursday 9:00AM
Swift Open Hours Developer Tools Lab A Thursday 12:00PM
Swift Open Hours Developer Tools Lab A Thursday 3:00PM
Swift Open Hours Developer Tools Lab A Friday 9:00AM
Swift Open Hours Developer Tools Lab A Friday 12:00PM
Swift Open Hours Developer Tools Lab A Friday 3:00PM
Labs
![Page 171: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/171.jpg)
SubtitleSwift Open Hours Developer Tools Lab A Tuesday 12:00PM
Swift Open Hours Developer Tools Lab A Tuesday 3:00PM
Swift Open Hours Developer Tools Lab A Wednesday 9:00AM
Swift Open Hours Developer Tools Lab A Wednesday 12:00PM
Swift Open Hours Developer Tools Lab A Wednesday 3:00PM
Swift Open Hours Developer Tools Lab A Thursday 9:00AM
Swift Open Hours Developer Tools Lab A Thursday 12:00PM
Swift Open Hours Developer Tools Lab A Thursday 3:00PM
Swift Open Hours Developer Tools Lab A Friday 9:00AM
Swift Open Hours Developer Tools Lab A Friday 12:00PM
Swift Open Hours Developer Tools Lab A Friday 3:00PM
Swift Open Hours
Labs
![Page 172: What’s New in Swift · 2.5x more Swift code 15% less code to rewrite the same functionality in Swift. Lines of code Project Evolution Dock is ~200,000 lines of code 2.5x more Swift](https://reader030.vdocument.in/reader030/viewer/2022040714/5e1a8d41c2a70108dc0f07b8/html5/thumbnails/172.jpg)