Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge....
Transcript of Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge....
![Page 1: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/1.jpg)
© 2016 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.
Using modern best practices
App Frameworks #WWDC16
Session 213
Improving Existing Apps
Woody L., 🐳 to the Knowledge
![Page 2: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/2.jpg)
Agenda
Reduce Technical DebtAsset CatalogsDependency InjectionLive Playgrounds
![Page 3: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/3.jpg)
Cycle of Development
You down with ‘Dub-DC? Yeah, you know me.
![Page 4: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/4.jpg)
Your bossLots of Requests
![Page 5: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/5.jpg)
Your customersMore Requests
![Page 6: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/6.jpg)
//TODO: Write and clean up
Technical Debt
Customer’s Perspective Actuality
![Page 7: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/7.jpg)
Duarte requesting hi-res photo
![Page 8: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/8.jpg)
Foundation
AppKit
Messages
MobileSafari
AirPortUtilityAppKit
OpenCL
WebKit Dock
iCal
udf
bash
cups
CFzsh
xnu
AVFoundation
ActivityMonitor
MobileSafari
BlueToothSettings
AccessibilitySettings GameKit
QuickTime
AirPortAssistant
AppStore
AppStore zsh
GameKitAirPortAssistant Dock
AirPortSettings
MapKit
PreferencesApp
MobileMusicPlayer
MobileMailMediaStreamMediaPlayerMediaPlayerUIGameKitServices
New API
![Page 9: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/9.jpg)
Source code compatibilitySwift 3
![Page 10: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/10.jpg)
New and Updated Platforms
![Page 11: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/11.jpg)
A Dev’s Run Loop
♽Technical Debt
New andUpdated APIs
Customer Roadmap
Platforms
Bug Fixes
![Page 12: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/12.jpg)
A Dev’s Run Loop
♽Technical Debt
New andUpdated APIs
Customer Roadmap
Platforms
Bug Fixes
![Page 13: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/13.jpg)
A Dev’s Run Loop
♽Technical Debt
New andUpdated APIs
Customer Roadmap
Platforms
Bug Fixes
![Page 14: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/14.jpg)
The Essentials
A very good place to start
![Page 15: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/15.jpg)
Minimum Deployment of iOS 8• 95% of Devices
Earlier 5%iOS 8
11%
iOS 9 84%
As measured by the App Store on May 9, 2016
![Page 16: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/16.jpg)
Latest update of previous releasePick a Deployment Target
![Page 17: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/17.jpg)
Deprecated API
![Page 18: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/18.jpg)
Deprecated API
![Page 19: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/19.jpg)
LLVM—Warning Policy, Xcode 7.3Treat Warnings as Errors
![Page 20: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/20.jpg)
Swift Compiler—Warning Policy, Xcode 8Treat Warnings as Errors NEW
![Page 21: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/21.jpg)
As much a part of your user interface as the artworkAccessibility in Xcode
![Page 22: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/22.jpg)
As much a part of your user interface as the artworkAccessibility in Xcode
![Page 23: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/23.jpg)
// Programmatic Accessibility of UI Components
let button = UIButton()
button.accessibilityLabel = "Add Bookmark"
![Page 24: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/24.jpg)
Locale-Aware APIs
Locale Obtain current region and format
DateFormatter Format and parse dates and times
NumberFormatter Format and parse numbers
Calendar and TimeZone Current calendar and associated operations
Dimension Represent specific units of measure
MeasurementFormatter Format and parse units of quantity
PersonNameComponents Names of people
![Page 25: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/25.jpg)
Locale-Aware APIs
Locale Obtain current region and format
DateFormatter Format and parse dates and times
NumberFormatter Format and parse numbers
Calendar and TimeZone Current calendar and associated operations
Dimension Represent specific units of measure
MeasurementFormatter Format and parse units of quantity
PersonNameComponents Names of people
NEW
![Page 26: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/26.jpg)
Add Peek, Pop, and Quick Actions
![Page 27: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/27.jpg)
Checklist for developer preview seedsGetting Ready for Autumn 2016
Run the Swift Migrator
Does it work?• No? Is it Apple’s problem or is it your code?• Are you using APIs in a way we didn’t expect?• Unit tests pass?
![Page 28: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/28.jpg)
bugreport.apple.comFile Bug Reports
![Page 29: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/29.jpg)
bugreport.apple.comFile Bug Reports
Dev Forums EmailBanter
MobileMe?
Broken!
![Page 30: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/30.jpg)
BugReport.apple.com
![Page 31: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/31.jpg)
Where Do Lonely Bug Reports Go?
![Page 32: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/32.jpg)
“La-La, Can’t Hear You”
![Page 33: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/33.jpg)
“Each bug report is as unique as a snowflake.”
Paul M., Apple Software Engineer
![Page 34: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/34.jpg)
Prepare your codebaseGet Started Today
iOS 9.3 + Xcode 7 iOS 10 + Xcode 8
Update project settings Use the Swift Migrator
Fix warnings Provide bug reports
Replace deprecated API Incorporate new API
Localize
Accessibility
![Page 35: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/35.jpg)
Asset Catalogs
Or, as some might write, Catalogues
![Page 36: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/36.jpg)
Files with naming conventionsThe Old Way
![Page 37: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/37.jpg)
Asset catalogThe Modern Way
![Page 38: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/38.jpg)
Add a Catalog
![Page 39: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/39.jpg)
Multiple Asset Catalogs
![Page 40: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/40.jpg)
Multiple Asset Catalogs
![Page 41: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/41.jpg)
Migrating Project Images
![Page 42: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/42.jpg)
Migrating Project Images
![Page 43: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/43.jpg)
Migrating Project Images
![Page 44: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/44.jpg)
Migrating Project Images
![Page 45: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/45.jpg)
Migration Completed
![Page 46: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/46.jpg)
// Loading Image Assets
// Old Way
if let logo = UIImage(contentsOfFile: Bundle.main().pathForResource("Logo", ofType: “png")) {
imageView.image = logo
}
// Modern Way
if let logo = UIImage(named: "List") {
imageView.image = logo
}
Old Way
![Page 47: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/47.jpg)
// Loading Image Assets
// Old Way
if let logo = UIImage(contentsOfFile: Bundle.main().pathForResource("Logo", ofType: “png")) {
imageView.image = logo
}
// Modern Way
if let logo = UIImage(named: "List") {
imageView.image = logo
}
Old Way
![Page 48: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/48.jpg)
// Loading Image Assets
// Old Way
if let logo = UIImage(contentsOfFile: Bundle.main().pathForResource("Logo", ofType: “png")) {
imageView.image = logo
}
// Modern Way
if let logo = UIImage(named: "List") {
imageView.image = logo
}
Old Way
![Page 49: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/49.jpg)
// Loading Image Assets
// Old Way
if let logo = UIImage(contentsOfFile: Bundle.main().pathForResource("Logo", ofType: “png")) {
imageView.image = logo
}
// Modern Way
if let logo = UIImage(named: "List") {
imageView.image = logo
}
Old Way
![Page 50: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/50.jpg)
Multiple Representations of Assets
![Page 51: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/51.jpg)
Multiple Representations of Assets
![Page 52: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/52.jpg)
Multiple Representations of Assets
![Page 53: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/53.jpg)
Multiple Representations of Assets
![Page 54: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/54.jpg)
Multiple Representations of Assets
![Page 55: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/55.jpg)
Multiple Representations of Assets
![Page 56: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/56.jpg)
Multiple Representations of Assets
![Page 57: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/57.jpg)
Multiple Representations of Assets
![Page 58: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/58.jpg)
Multiple Representations of Assets
![Page 59: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/59.jpg)
Asset Types
Individual Scales Single Vector
PNGs PDFs
![Page 60: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/60.jpg)
Selecting the Scale Factor
![Page 61: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/61.jpg)
No 2x and 3x artworkMissing Scaled Asset Representations
![Page 62: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/62.jpg)
No 2x and 3x artworkMissing Scaled Asset Representations
Scaled up for Retina devices
Missing Retina artwork
![Page 63: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/63.jpg)
Only 3x mediaMissing PNG Asset Representations
Scaled down for 1x and 2x displays
Missing 1x and 2x artwork
![Page 64: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/64.jpg)
Asset Scaling and Memory
1x 3x9Kb 943Kb
![Page 65: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/65.jpg)
Memory PressureM
emor
y U
tiliz
atio
n
Temporary Memory Spike
Start 3x Image Load Image Opened and Scaling to 2x Scaled, Original Deallocated
![Page 66: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/66.jpg)
Memory PressureM
emor
y U
tiliz
atio
n
Temporary Memory Spike
Start 3x Image Load Image Opened and Scaling to 2x Scaled, Original Deallocated
![Page 67: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/67.jpg)
Memory PressureM
emor
y U
tiliz
atio
n
Temporary Memory Spike
Start 3x Image Load Image Opened and Scaling to 2x Scaled, Original Deallocated
![Page 68: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/68.jpg)
Automator
![Page 69: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/69.jpg)
-
![Page 70: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/70.jpg)
Scalable to any sizeVector Assets
![Page 71: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/71.jpg)
Scalable to any sizeVector Assets
![Page 72: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/72.jpg)
Scaled and rasterized at build timeVector Assets
![Page 73: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/73.jpg)
Scaled and rasterized at build timeVector Assets
![Page 74: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/74.jpg)
Improving asset image qualityOverride Universal Vector Assets
![Page 75: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/75.jpg)
Improving asset image qualityOverride Universal Vector Assets
![Page 76: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/76.jpg)
Lossy and losslessImage Compression NEW
![Page 77: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/77.jpg)
Challenge of rounded cornersCapped Images
Continue
![Page 78: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/78.jpg)
Challenge of rounded cornersCapped Images
Continue
![Page 79: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/79.jpg)
Challenge of rounded cornersCapped Images
Continue
![Page 80: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/80.jpg)
Challenge of rounded cornersCapped Images
Continue
![Page 81: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/81.jpg)
Challenge of rounded cornersCapped Images
Continue
![Page 82: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/82.jpg)
Challenge of rounded cornersCapped Images
Continue
![Page 83: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/83.jpg)
Interface Builder’s Attributes InspectorButton Background Image
![Page 84: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/84.jpg)
Interface Builder’s Attributes InspectorButton Background Image
![Page 85: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/85.jpg)
Interface Builder’s Attributes InspectorButton Background Image
![Page 86: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/86.jpg)
Challenge of rounded cornersCapped Images
RoundedRectangle
![Page 87: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/87.jpg)
Challenge of rounded cornersCapped Images
![Page 88: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/88.jpg)
// Stretchable Images
// Programmatic, Traditional Way:
if let image = UIImage(named: “RoundedRectangle")
let background = image.stretchableImage(withLeftCapWidth: 10, topCapHeight: 10) {
button.setBackgroundImage(background, for: [])
}
![Page 89: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/89.jpg)
Asset Slicing
![Page 90: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/90.jpg)
Asset Slicing
![Page 91: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/91.jpg)
Don’t stretch these edges H H
HH
![Page 92: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/92.jpg)
Don’t stretch these edges H H
HH
![Page 93: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/93.jpg)
Repeat these pixels
![Page 94: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/94.jpg)
Repeat these pixels
![Page 95: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/95.jpg)
Preserving of rounded cornersCapped Images
![Page 96: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/96.jpg)
Asset CatalogsSummary
Use Asset CatalogsVector images preserve image qualityScaled images should be provided for each asset representation (1x, 2x, 3x)Perform slicing within the asset catalog
![Page 97: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/97.jpg)
Dependency Injection
Pay it forward
![Page 98: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/98.jpg)
Methods relating to UITextFieldUITextFieldDelegate
UITextField UITextFieldDelegate
func textFieldShouldBeginEditing(_ textField:
UITextField) -> Bool
func textFieldDidBeginEditing(_ textField: UITextField)
![Page 99: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/99.jpg)
Methods relating to WCSessionWCSessionDelegate
WCSession WCSessionDelegate
func session(_ session: WCSession,
activationDidCompleteWith activationState:
WCSessionActivationState, error: NSError?)
![Page 100: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/100.jpg)
Everything elseApp Delegate
NS/UIApplication NS/ApplicationDelegate
![Page 101: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/101.jpg)
Everything elseApp Delegate
NS/UIApplication NS/ApplicationDelegate
func applicationWillResignActive(_ application: UIApplication)
![Page 102: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/102.jpg)
Everything elseApp Delegate
NS/UIApplication NS/ApplicationDelegate
func applicationWillResignActive(_ application: UIApplication)
var sqlite3DB: SQLite3Db?
![Page 103: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/103.jpg)
Everything elseApp Delegate
NS/UIApplication NS/ApplicationDelegate
func applicationWillResignActive(_ application: UIApplication)
var sqlite3DB: SQLite3Db?
var sink = Kitchen(garbageDisposal: true)
![Page 104: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/104.jpg)
Convenient, but strongly coupledAccessing the App Delegate
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return (UIApplication.shared().delegate as? AppDelegate)?.content?.count ?? 0
}
![Page 105: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/105.jpg)
Tight couplingReach-Back to the App Delegate
View Controller AMailboxes
View Controller BMessages
View Controller CDetail
Application Delegate[MyModel]
![Page 106: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/106.jpg)
Pay it forwardDependency Injection
MailboxesVC[Mailbox]()
MessagesVC[Message]?
MessageVCMessage?
Application Delegate
![Page 107: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/107.jpg)
Storyboard SeguesDependency Injection
override func prepare(for segue: UIStoryboardSegue, sender: AnyObject?) {
if let messagesVC = segue.destinationViewController as? MessagesViewController {
messagesVC.content = model
}
}
MailboxesVC var content = [MailBoxes]()
MessagesViewControllervar: [MyModel]?
![Page 108: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/108.jpg)
MailboxesVC var content = [MailBoxes]()
MessagesViewControllervar: [MyModel]?
Programatic presentationDependency Injection
@IBAction func showDetailVC(sender: AnyObject?) {
let detailVC = DetailVC()
let indexOfSelectedMessage = 0// ...
let message = messages[indexOfSelectedMessage]
detailVC.message = message
}
Continue
![Page 109: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/109.jpg)
Coming back from Dependency InjectionReturning from the View Controller
Create and implement a Protocol• UIImagePickerControllerDelegate• MFMailComposeViewControllerDelegate• Mark the delegate property as weak to prevent memory leaks to prevent circular references
Pass a Closure to the Destination View ControllerPass Model Objects by ReferenceUnwind/Exit Segues, with prepareForSegue:
![Page 110: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/110.jpg)
Flashback to 2015Previously at WWDC
Once upon a time, in a session room not that far away…
![Page 111: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/111.jpg)
Modernizing existing apps with SwiftWWDC2015
![Page 112: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/112.jpg)
Modernizing existing apps with SwiftWWDC2015
Playgrounds InteroperabilityModern UI
![Page 113: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/113.jpg)
Live Playgrounds!
Better than !(Live Playgrounds)
![Page 114: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/114.jpg)
DemoTableViews in Live Playgrounds
The Needle? We like to move it, move it.
![Page 115: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/115.jpg)
Live Playground supporting APIDemo Summary
Import the Playground Module
import PlaygroundSupport
Indefinite/Asynchronous Execution
PlaygroundPage.current.needsIndefiniteExecution = true
Assign a Live View
PlaygroundPage.current.liveView = customTableViewController.tableView
![Page 116: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/116.jpg)
TipsDemo Summary
Playground Sources and Resources• Files dragged to these folders are copied, not referenced• Methods, properties, and data types in the Sources folder must use the Public specifier
![Page 117: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/117.jpg)
Caches folderDemo Summary
Temporary data that can be recreated if it’s missingThumbnailsDownloaded resourcesPurged when device under storage pressure
let fm = FileManager.default()
let cacheUrl = fm.urlsForDirectory(.cachesDirectory, inDomains: .userDomainMask).last
![Page 118: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/118.jpg)
Powerful and performantURLSession
Out-of-process networkingDelegation and completion handlersSupported by tvOS, iOS, macOS, and watchOS platformsBacked by the expertise of our core networking engineers
NSURLSession: New Features and Best Practices Pacific Heights Thursday 10:00AM
Networking for the Modern Internet Pacific Heights Thursday 3:00PM
![Page 119: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/119.jpg)
Must See
It’s time to play the music, it’s time to light the lights
Tv16
![Page 120: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/120.jpg)
// tvOS Conditional Compilation
#if os(tvOS)
backgroundImageView.adjustsImageWhenAncestorFocused = true
#endif
![Page 121: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/121.jpg)
Human Interface GuidelinesAdopting Additional Platforms
![Page 122: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/122.jpg)
Invoicing
![Page 123: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/123.jpg)
Financial Charts
![Page 124: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/124.jpg)
Adding Platforms
Read and use our Human Interface GuidelinesDesign to the platformPivot your data model
![Page 125: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/125.jpg)
Summary
Modernizing your app is an on-going processRely on the frameworksStart today—No need to wait for Xcode 8Live Playgrounds allow for more experimentationArchitect your app with few inter-object dependenciesConsider bringing your model layer to our other platforms, with platform-specific UI
![Page 126: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/126.jpg)
Related Sessions
What’s New in Cocoa Touch Presidio Tuesday 1:40PM
What’s New in tvOS Presidio Tuesday 3:00PM
What’s New in watchOS 3 Presidio Tuesday 5:00PM
What’s New in Swift Presidio Tuesday 9:00AM
Crafting Modern Cocoa Apps Pacific Heights Friday 5:00PM
Increase Usage of Your App with Proactive Suggestions Mission Friday 1:40PM
![Page 127: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/127.jpg)
Labs
Cocoa Touch Lab Frameworks Lab A Wednesday 3:00PM
Cocoa Lab Frameworks Lab D Thursday 2:00PM
Interface Builder and Auto Layout Lab Developer Tools Lab C Friday 9:00AM
UIKit and UIKit Animations Lab Frameworks Lab C Thursday 1:00PM
Swift Open Hours Developer Tools Lab A Daily
![Page 128: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/128.jpg)
More Information
https://developer.apple.com/wwdc16/213
![Page 129: Improving Existing Apps - Apple Inc.€¦ · Improving Existing Apps Woody L., ! to the Knowledge. Agenda Reduce Technical Debt Asset Catalogs Dependency Injection Live Playgrounds.](https://reader030.fdocuments.net/reader030/viewer/2022011902/5f0bb0787e708231d431bc4d/html5/thumbnails/129.jpg)