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

Scouting Swift 3

06609d73ad2165c4aafcf65a1ddb9563?s=47 Greg Heo
November 05, 2016
62

Scouting Swift 3

Talk from CocoaConf San Jose, November 2016. Conference materials available at https://github.com/gregheo/CocoaConfSJ2016

06609d73ad2165c4aafcf65a1ddb9563?s=128

Greg Heo

November 05, 2016
Tweet

Transcript

  1. San Jose
 November 2016 Scouting Swift 3 @gregheo

  2. NSSelectorForString @selector() ?

  3. typedef struct objc_selector *SEL;

  4. obj.performSelector("someSelector")


  5. public struct Selector : ExpressibleByStringLiteral

  6. obj.performSelector("someSelector")
 obj.performSelector(Selector("someSelector"))

  7. #selector(NSString.init(coder:)) “initWithCoder:”

  8. #keyPath(NSString.length) “length”: String

  9. #keyPath #selector #available

  10. Module File open public internal fileprivate { private } (scary

    outside world)
  11. Function { } closure did not escape

  12. Function { } closure escaped! # async
 store to property

    { }
  13. @discardableResult @warn_unused_result

  14. at the point of use is your most important goal

    CLARITY
  15. func moveFromPoint(_ start: Point, toPoint: Point) moveFromPoint(startPoint, toPoint: endPoint)

  16. func move(from start: Point, to end: Point) move(from: startPoint, to:

    endPoint)
  17. NSString NSArray CGFloat NSIndexPath NSURLRequest

  18. NSString NSArray CGFloat NSIndexPath NSURLRequest

  19. let myQueue = DispatchQueue(label: "com.cocoaconf.queue")
 
 let mainQueue = DispatchQueue.main

  20. myQueue.sync { print("Hello from a queue") } mainQueue.async { print("Hello

    async") }
  21. myQueue.asyncAfter(deadline: .now() + 5,
 execute: ...) myQueue.asyncAfter(deadline: .now() + .nanoseconds(2500),


    execute: ...)
  22. let renderer = UIGraphicsImageRenderer(
 bounds: CGRect(x: 0, y: 0, width:

    100, height: 100)) let renderedImage = renderer.image { context in // drawing code goes here } UIImage
  23. None
  24. None
  25. Safety Non-escaping closures Clarity / API changes Bridging Playgrounds

  26. San Jose
 November 2016 Scouting Swift 3 @gregheo feedback $

    %