ios 7 - goto conferencegotocon.com/dl/2013/gotonights/ios_7_-_what_you_need_to...•sentest- and...

60
iOS 7 What You Need to Know

Upload: others

Post on 20-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

iOS 7What You Need to Know

Page 2: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test
Page 3: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

• GOTO Conference

• GOTO night

• Training

Page 4: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Modules@import

Page 5: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Demo!

Page 6: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Modules

• Easier to use

• No namespace pollution

• You get it for free

• Performance (build time and indexing)

Page 7: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Modules

• Caveats

• Requires iOS7 / OS X 10.9 SDK

• Not available for user frameworks

Page 8: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Modules

404 Advances in Objective-C

Page 9: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Unit Testing in Xcode 5...finally being taken seriously

Page 10: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Demo!

Page 11: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

• SenTest- and XCTest can co-exist

• New in Xcode 5

- Migration tool

- Test failure break-point

- Test assistant categories

- Test again command

Page 12: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

409 Testing in Xcode 5

More on Unit Testing

Page 13: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Test Bots

Page 14: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

No Demo! :-(

Page 15: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test
Page 16: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

• Test on simulator and physical devices

• Deep integration with Xcode

• Good terminal support

Bots

Page 17: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

More on Bots and CI

412 Continuous Integration with Xcode 5

Page 18: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Auto LayoutThey fixed it !

Page 19: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Springs and Strutswhy not?

Page 20: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Springs and Strutswhy not?

Page 21: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Auto Layout in iOS6 IB

Page 22: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Demo!

Page 23: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

406 Taking Control of Autolayot in Xcode 5

Page 24: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Xcode 5Other enhancements

Page 25: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

• Capabilities

• Images.xcassets

Page 26: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Sandwich

Page 27: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Multitasking

Page 28: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

[WWDC 2013: 204 Whats new With Multitasking]

Page 29: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

[WWDC 2013: 204 Whats new With Multitasking]

Page 30: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

New multitasking APIs

• Background Fetch

• Remote Notifications

• Background Transfer Service

Page 31: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Background Fetch

• Update your tweets or Facebook posts while app is backgrounded

Page 32: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Demo!

Page 33: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Background Fetch

• Update you social media data

• But what else?

• Simulate remote notifications

• What are the constraints ?

Page 34: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Background Fetch

• System scheduled (coalesced)

• Adapts from usage pattern

Page 35: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Remote NotificationsMotivation

• Update the App Content before the user opens the App.

Page 36: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Remote Notifications

1. Set the Background mode

2. Implement the AppDelegate callback

Page 37: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Remote Notifications

aps { content-available: 1 alert: {...}} Omit for silent notification

Page 38: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Background Transfer ServiceMotivation

• Upload/download large files

• Continue even after app exists

• Enqueue from background and foreground

Page 39: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Demo!

Page 40: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Use case example

1. New content available

2. Server sends silent push notification

3. App starts background transfer service

4. Transfer completes and App presents a local notification

Page 41: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

204 Whats new With Multitasking

Page 42: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

JavaScript Core

Page 43: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

JSVirtualMachine *vm = [JSVirtualMachine new]JSContext *context = [[JSContext alloc] initWithVirtualMachine:vm];context[@"a"] = @5;

JSValue *aValue = context[@"a"];double a = [aValue toDouble];NSLog(@"%.0f", a); // => 5

[context evaluateScript:@"a = 10"];JSValue *newAValue = context[@"a"];NSLog(@"%.0f", [newAValue toDouble]); // => 10

Page 44: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

JavaScript CoreObject Bridging

Person *person = [[Person alloc] init];person.name = @"Søren";context[@"person"] = person;

• Create a PersonExports <JSExports> protocol

• @property => JavaScript getter/setter

• instance method => JavaScript function

Page 45: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

UIKit Dynamics

Page 46: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

[WWDC 2013: 206 Getting Started With UIKit Dynamics]]

Page 47: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

animator = [[UIDynamicAnimator alloc] initWithReferenceView:referenceView];[animator addBehavior:...];[animator addBehavior:...];

Page 48: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Predefined Behaviors

• Gravity

• Collision

• Attachments (and Springs)

• Snap

• Forces (Push)

• Item Properties

Page 49: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Demo!

Page 50: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

206 Getting Started with UIKit Dynamics

Page 51: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Sprite Kit

Page 52: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

SKSpriteNode *sprite = [SKSpriteNode spriteNodeWithImageNamed:@"hero.png"];[sprite runAction:[SKAction fadeOutWithDuration:1.0]];

Declarative

[myNode runAction: [SKAction sequence:@[action1, action2, action3]] ];

Composable Actions

[SKVideoNode videoNodeWithVideoFileNamed:@"video.mp4"];Cool

Integrated physicsSKSpriteNode *sprite = [SKSpriteNode spriteNodeWithImageNamed:@"ball.png"];sprite.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:sprite.size.width * 0.5];

Page 53: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test
Page 54: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

502 Introduction to Sprite Kit

Page 55: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

...and the rest

Page 56: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

Other API Goodies• Add attachments to mail

(Message UI Framework)

• Base64Encode NSData

• [NSArray firstObject]

• Barcode Scanner(AVFoundation)

• AVSpeechSynthesizer

• MKDistanceFormatter

• [UIView snapshotView...]

Page 57: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

NSURLComponents and NSCharacterSet (NSURLUtilities)

NSURLComponents *components = [NSURLComponents componentsWithString:@"http://nshipster.com"];components.path = @"/iOS7";components.query = @"foo=bar"

//http://nshipster.com/iOS7?foo=bar

Page 58: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

NSURLComponents and NSCharacterSet (NSURLUtilities)

NSCharacterSet+ (id)URLUserAllowedCharacterSet+ (id)URLPasswordAllowedCharacterSet+ (id)URLHostAllowedCharacterSet+ (id)URLPathAllowedCharacterSet+ (id)URLQueryAllowedCharacterSet+ (id)URLFragmentAllowedCharacterSet

Page 59: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

I’m sorry....

Page 60: iOS 7 - GOTO Conferencegotocon.com/dl/2013/GOTONights/iOS_7_-_What_You_Need_to...•SenTest- and XCTest can co-exist • New in Xcode 5 -Migration tool-Test failure break-point-Test

TextKit Custom ViewController Transition

Core Bluetooth

Multipeer Connectivity

App Transfer