Top Banner
What’ s new in iOS 9 @adhumi, Trainline Cocoaheads Paris, jan. 2017
38

What's new in iOS9

Mar 19, 2017

Download

Software

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: What's new in iOS9

What’s new in iOS 9

@adhumi, Trainline

Cocoaheads Paris, jan. 2017

Page 2: What's new in iOS9

Page 3: What's new in iOS9
Page 4: What's new in iOS9
Page 5: What's new in iOS9
Page 6: What's new in iOS9
Page 7: What's new in iOS9

What is already used(or could be)

Page 8: What's new in iOS9

iPad Multitasking / Split screen & slide over

Gif animé de changement de size class

Page 9: What's new in iOS9

iPad Multitasking / Split screen & slide over

Out of the box ✨(if you support size classes correctly)

Page 10: What's new in iOS9

iPad Multitasking / Split screen & slide over

<key>UIRequireFullScreen</key> <true/>

Opt-out (info.plist)

Page 11: What's new in iOS9

Search API

Add content to spotlight"

Page 12: What's new in iOS9

Search API

NSUserActivityFor current activity indexation (can be public)

var activity = NSUserActivity(activityType: "com.ct.capitainetrain") activity.title = "Paris → Carpentras" activity.userInfo = ["id": "www.trainline.fr/results/paris/carpentras"] activity.isEligibleForSearch = true

"

Page 13: What's new in iOS9

Search API "

let attributeSet = CSSearchableItemAttributeSet( itemContentType: kUTTypeData)

attributeSet.title = "Private searchable item"

let item = CSSearchableItem(uniqueIdentifier: "AE4F-C8C24D", domainIdentifier: "domain", attributeSet: attributeSet)

CSSearchableIndex.default().indexSearchableItems([item], completionHandler: nil)

CoreSpotlightFor massive and/or private, indexation

Page 14: What's new in iOS9

App thinning / Bitcode & App Slicing

Archive

iTunes Connect

App record

App Store

armv7, arm64

iPhone, iPad

screen density

Page 15: What's new in iOS9

App thinning / Bitcode & App Slicing

Default on iOS (optional) Mandatory on watchOS and tvOS

⚠ Dependencies need to support Bitcode

~20-50% size gain

Page 16: What's new in iOS9

Keyboard shortcuts

Page 17: What's new in iOS9

Keyboard shortcuts

override var keyCommands: [UIKeyCommand]? { return [UIKeyCommand(input: "\r", modifierFlags: .command, action: #selector(onCommandEnter(_:)), discoverabilityTitle: "Validate")] }

override var keyCommands: [UIKeyCommand]?

Page 18: What's new in iOS9

3D Touch / Quick Actions

Page 19: What's new in iOS9

3D Touch / Quick Actions

let shortcut = UIApplicationShortcutItem(type: "fr.adhumi.app.message", localizedTitle: "Send message") UIApplication.shared.shortcutItems = [shortcut]

Dynamic

Static Compile time

Runtime

Page 20: What's new in iOS9

3D Touch / Peek & Pop

func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit vc: UIViewController) { self.navigationController?.pushViewController(vc, animated: true) }

override func viewDidLoad() { self.registerForPreviewing(with: self, sourceView: self.view) }

func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? { return MyController() }

Page 21: What's new in iOS9

What’s really newand can be adopted

Page 22: What's new in iOS9

UIAlertView

UIActionSheet

↓UIAlertController

Page 23: What's new in iOS9

UIAlertController

Page 24: What's new in iOS9

UIAlertController

self.present(alert, animated: true, completion: nil)

let alert = UIAlertController(title: "Uh oh!", message: "An error occured.", preferredStyle: .alert)

let resolve = UIAlertAction(title: "Resolve", style: .destructive) { (action) in // Do stuff } alert.addAction(resolve)

let cancel = UIAlertAction(title: "Cancel", style: .cancel) { (action) in // Do stuff } alert.addAction(cancel)

Page 25: What's new in iOS9

UIWebView

WKWebView

↓SFSafariViewController

Page 26: What's new in iOS9

SFSafariViewController

Page 27: What's new in iOS9

SFSafariViewController

let url = URL(string: "https://www.trainline.fr")

let safari = SFSafariViewController(url: url!)

self.navigationController?.pushViewController(safari, animated: true)

Page 28: What's new in iOS9

AddressBook.framework

↓Contacts.framework

Page 29: What's new in iOS9

Contacts.framework

let contacts = CNContactPickerViewController() contacts.delegate = self self.present(contacts, animated: true, completion: nil)

func contactPicker(_ picker: CNContactPickerViewController, didSelect contact: CNContact) { print(contact.givenName) print(contact.emailAddresses) }

let firstName: String = ABRecordCopyValue(contact, kABPersonFirstNameProperty).takeRetainedValue()

Page 30: What's new in iOS9

App thinning / On Demand Resources

Xcode project

tag-yellow tag-blueNo tag

APP

Page 31: What's new in iOS9

App thinning / On Demand Resources

let tags: Set<String> = ["tag-yellow, tag-blue"] let request = NSBundleResourceRequest(tags: tags)

request.beginAccessingResources { (error) in if let error = error { print(error) } else { print("Resources available") } }

Page 32: What's new in iOS9

NSLayoutConstraint(item: view1, attribute: .centerX, relatedBy: .equal, toItem: view2, attribute: .leading, multiplier: 1, constant: 0)

↓view1.centerXAnchor.constraint(equalTo: view2.leadingAnchor)

Page 33: What's new in iOS9

Auto Layout

New syntax

UILayoutGuide (👋 empty views)

Anchors

Page 34: What's new in iOS9

Auto Layout

UIStackView

Page 35: What's new in iOS9

Auto Layout

Page 36: What's new in iOS9

Auto Layout

let stackView = UIStackView() stackView.axis = .vertical stackView.distribution = .equalSpacing stackView.alignment = .center stackView.spacing = 8

stackView.addArrangedSubview(logo) stackView.addArrangedSubview(title)

Page 37: What's new in iOS9

Split screen

Search APIs

Bitcode, App Slicing

Keyboard shortcuts

3D Touch (peek/pop & quick actions)

Auto Layout

UIAlertController

SFSafariViewController

On Demand Resources

Contacts.framework

Page 38: What's new in iOS9

Thanks! 💚

@adhumi, Trainline 💻 trainline.fr/jobs