Upgrade to Pro — share decks privately, control downloads, hide ads and more …

iOS 8: the little things

iOS 8: the little things

Let's talk about the smaller features in iOS 8 and Xcode 6.
Slides from my talk at Ottawa Cocoaheads, Sept 11.

Some features stolen from nshipster.com, Erica Sadun and Xamarin posts.

Avatar for Steven Thompson

Steven Thompson

September 11, 2014

Other Decks in Programming

Transcript

  1. UITouches now have a radius property UITouch *touch = [touches

    lastObject]; touch.majorRadius; // 20 Also includes majorRadiusTolerance, a +- range per screen
  2. Constraints You can now activate and deactivate constraints! Instead of

    just top and bottom, you can now add constraints linked to top, bottom, left, and right margins.
  3. UIAlertController No more UIAlertView or UIActionSheet + (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString

    *)message preferredStyle:(UIAlertControllerStyle)preferredStyle preferredStyle: - UIAlertControllerStyleActionSheet - UIAlertControllerStyleAlert
  4. So much SpriteKit, it's amazing —SKConstraints, orientation, limit position —Pixel

    perfect physics bodies, SKPhysicsBody bodyWithTexture:node.texture
  5. CollectionView enhancements —set EstimatedItemSize in a flow layout to self

    size cells —PreferredLayoutAttributesFittingAttributes lets you override layout for individual cells
  6. UIVisualEffect Can make a blur or 'vibrancy' effect to view

    in a UIVisualEffectView [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
  7. Search within storyboards! Highlights matches in the storyboard, and opens

    the hierarchy to the right point. Finds: - image names - labels - text - custom classes Also, global search includes storyboards
  8. Performance testing - (void)testPerformance { [self measureBlock:^{ // Slow stuff

    }]; } Gives you ten runs, average and standard deviation from previous
  9. Asynchronous testing - (void)testAsync { XCTestExpectation *asyncExpectation = [self expectationWithDescription:@"Async

    test"]; [manager doSomethingAsynchronousSuccess:^(id response) { [asyncExpectation fulfill]; XCTAssertNotNil(responseObject, @"No data returned"); } failure:^(id response) { [asyncExpectation fulfill]; XCTFail(@"Fetch failed with error: %@", [error description]); }]; [self waitForExpectationsWithTimeout:5 handler:nil]; }
  10. Async testing, and performance testing - (void)testAwesome { [self measureBlock:^{

    XCTestExpectation *fetchExpectation = [self expectationWithDescription:@"Async test"]; [manager POST:request parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) { [fetchExpectation fulfill]; XCTAssertNotNil(responseObject, @"No data returned"); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { [fetchExpectation fulfill]; XCTFail(@"Fetch failed with error: %@", [error description]); }]; [self waitForExpectationsWithTimeout:5 handler:nil]; }]; }
  11. Launch screen file Support all device sizes with a storyboard

    to replace your launch images This disables scaling for iPhone 6 and 6 plus!