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

The Maturation of Swift

The Maturation of Swift

In 2018, Swift has stretched its wings into a truly widespread language. Join me as we take a look at how mobile apps, servers, functions, and even data science can be written in one language.

David Okun

June 11, 2018
Tweet

More Decks by David Okun

Other Decks in Programming

Transcript

  1. @dokun24 @mccoyjus

  2. @dokun24 @mccoyjus

  3. @dokun24 @mccoyjus

  4. @dokun24 @mccoyjus

  5. @dokun24 @mccoyjus

  6. @dokun24 @mccoyjus

  7. @dokun24 @mccoyjus Objective-C

  8. @dokun24 @mccoyjus Node.js Objective-C

  9. @dokun24 @mccoyjus Java Node.js Objective-C

  10. @dokun24 @mccoyjus Python Java Node.js Objective-C

  11. @dokun24 @mccoyjus The History of Swift

  12. @dokun24 @mccoyjus The History of Swift • June 2014 -

    Swift is released
  13. @dokun24 @mccoyjus The History of Swift • June 2014 -

    Swift is released • June 2015 - Swift on Linux is announced
  14. @dokun24 @mccoyjus The History of Swift • June 2014 -

    Swift is released • June 2015 - Swift on Linux is announced • December 2015 - swift.org goes live
  15. @dokun24 @mccoyjus The History of Swift • June 2014 -

    Swift is released • June 2015 - Swift on Linux is announced • December 2015 - swift.org goes live • March 2016 - First Linux build available
  16. @dokun24 @mccoyjus The History of Swift • June 2014 -

    Swift is released • June 2015 - Swift on Linux is announced • December 2015 - swift.org goes live • March 2016 - First Linux build available • June 2016 - Kitura at WWDC
  17. @dokun24 @mccoyjus The History of Swift • June 2014 -

    Swift is released • June 2015 - Swift on Linux is announced • December 2015 - swift.org goes live • March 2016 - First Linux build available • June 2016 - Kitura at WWDC • October 2017 - Kitura 2.0
  18. @dokun24 @mccoyjus Python Java Node.js Objective-C

  19. @dokun24 @mccoyjus Objective-C

  20. @dokun24 @mccoyjus Objective-C’s Place In iOS

  21. @dokun24 @mccoyjus Objective-C’s Place In iOS • Smalltalk + C

  22. @dokun24 @mccoyjus Objective-C’s Place In iOS • Smalltalk + C

    • “Easy” interoperability with C++
  23. @dokun24 @mccoyjus Objective-C’s Place In iOS • Smalltalk + C

    • “Easy” interoperability with C++ • Created in 1981
  24. @dokun24 @mccoyjus Objective-C’s Place In iOS • Smalltalk + C

    • “Easy” interoperability with C++ • Created in 1981 • Licensed by NeXT in 1988
  25. @dokun24 @mccoyjus Objective-C’s Place In iOS • Smalltalk + C

    • “Easy” interoperability with C++ • Created in 1981 • Licensed by NeXT in 1988 • GCC extended to support it
  26. @dokun24 @mccoyjus Objective-C’s Place In iOS

  27. @dokun24 @mccoyjus Objective-C’s Place In iOS • Then…Clang and support

    for LLVM
  28. @dokun24 @mccoyjus Objective-C’s Place In iOS • Then…Clang and support

    for LLVM • iOS developers’ first choice
  29. @dokun24 @mccoyjus Objective-C’s Place In iOS • Then…Clang and support

    for LLVM • iOS developers’ first choice • Still focused on manual memory management via reference counting
  30. @dokun24 @mccoyjus 2014

  31. @dokun24 @mccoyjus 2014 • Craig Federighi announced Swift

  32. @dokun24 @mccoyjus 2014 • Craig Federighi announced Swift • A

    focus on functions as first class objects
  33. @dokun24 @mccoyjus 2014 • Craig Federighi announced Swift • A

    focus on functions as first class objects • Type-safety, automatic memory management
  34. @dokun24 @mccoyjus if !NSUserDefaults.standardUserDefaults().boolForKey("copyAndPasteEnabled") { NSOperationQueue.mainQueue().addOperationWithBlock { () -> Void

    in UIMenuController.sharedMenuController().setMenuVisible(false, animated: false) } }
  35. @dokun24 @mccoyjus Swift 2

  36. @dokun24 @mccoyjus Swift 2 • Focus on basic language needs

    • try • throw • catch
  37. @dokun24 @mccoyjus Swift 2 • Focus on basic language needs

    • try • throw • catch • Protocol extensions
  38. @dokun24 @mccoyjus Swift 2 • Focus on basic language needs

    • try • throw • catch • Protocol extensions • Open source announcement
  39. @dokun24 @mccoyjus Swift 3

  40. @dokun24 @mccoyjus Swift 3 • Focus on stability, ABI (application

    binary interface)
  41. @dokun24 @mccoyjus Swift 3 • Focus on stability, ABI (application

    binary interface) • The great NS removal
  42. @dokun24 @mccoyjus Swift 3 • Focus on stability, ABI (application

    binary interface) • The great NS removal • NSUserDefaults -> UserDefaults
  43. @dokun24 @mccoyjus Python Java Node.js Objective-C

  44. @dokun24 @mccoyjus Python Java Node.js Swift

  45. @dokun24 @mccoyjus Node.js

  46. @dokun24 @mccoyjus Node.js

  47. @dokun24 @mccoyjus Node.js • It’s fine

  48. @dokun24 @mccoyjus Node.js • It’s fine • Accessible to all

  49. @dokun24 @mccoyjus Node.js • It’s fine • Accessible to all

    • Tons more I/O based performance
  50. @dokun24 @mccoyjus

  51. @dokun24 @mccoyjus

  52. @dokun24 @mccoyjus

  53. @dokun24 @mccoyjus

  54. @dokun24 @mccoyjus

  55. @dokun24 @mccoyjus

  56. @dokun24 @mccoyjus Kitura - The Swift RESTful API Framework

  57. @dokun24 @mccoyjus Kitura - The Swift RESTful API Framework •

    Written just like Express.js
  58. @dokun24 @mccoyjus Kitura - The Swift RESTful API Framework •

    Written just like Express.js • Works on macOS and Linux
  59. @dokun24 @mccoyjus Kitura - The Swift RESTful API Framework •

    Written just like Express.js • Works on macOS and Linux • Front-end templating
  60. @dokun24 @mccoyjus Kitura - The Swift RESTful API Framework •

    Written just like Express.js • Works on macOS and Linux • Front-end templating • ORM capabilities
  61. @dokun24 @mccoyjus Kitura - The Swift RESTful API Framework •

    Written just like Express.js • Works on macOS and Linux • Front-end templating • ORM capabilities • Client SDK generation
  62. @dokun24 @mccoyjus import Kitura let router = Router() router.get("/") {

    request, response, next in response.send("Hello world") next() } Kitura.addHTTPServer(onPort: 8080, with: router) Kitura.run()
  63. @dokun24 @mccoyjus Kitura Runs On

  64. @dokun24 @mccoyjus Kitura Runs On • Cloud Foundry

  65. @dokun24 @mccoyjus Kitura Runs On • Cloud Foundry • Docker

  66. @dokun24 @mccoyjus Kitura Runs On • Cloud Foundry • Docker

    • Kubernetes
  67. @dokun24 @mccoyjus Python Java Node.js Swift

  68. @dokun24 @mccoyjus Python Java Swift Swift

  69. @dokun24 @mccoyjus Java

  70. @dokun24 @mccoyjus Cloud Functions / FaaS

  71. @dokun24 @mccoyjus Cloud Functions / FaaS • AKA Serverless

  72. @dokun24 @mccoyjus Cloud Functions / FaaS • AKA Serverless •

    Serverless is…just another server
  73. @dokun24 @mccoyjus Cloud Functions / FaaS • AKA Serverless •

    Serverless is…just another server • Focus on your functions
  74. @dokun24 @mccoyjus FaaS Languages

  75. @dokun24 @mccoyjus FaaS Languages • Java • Python • Node.js

    • Go • Ruby • Scala • Swift
  76. @dokun24 @mccoyjus The Key of FaaS

  77. @dokun24 @mccoyjus The Key of FaaS • Don’t worry about

    your server
  78. @dokun24 @mccoyjus The Key of FaaS • Don’t worry about

    your server • Worry about your code
  79. @dokun24 @mccoyjus struct Record: Codable { var name: String var

    office: String } enum RecordError: Error { case newRecordError } func main(input: Record, respondWith: (Record?, RecordError?) -> Void) { let newRecord = Record(name: “David”, office: “IBM”) respondWith(newRecord, nil) }
  80. @dokun24 @mccoyjus Python Java Swift Swift

  81. @dokun24 @mccoyjus Python Swift Swift Swift

  82. @dokun24 @mccoyjus Python

  83. @dokun24 @mccoyjus Python

  84. @dokun24 @mccoyjus Python • The Data Science Language

  85. @dokun24 @mccoyjus Python • The Data Science Language • Meant

    for heavy computation
  86. @dokun24 @mccoyjus Python • The Data Science Language • Meant

    for heavy computation • Focused on usability, above all
  87. @dokun24 @mccoyjus The Jupyter Project

  88. @dokun24 @mccoyjus The Jupyter Project • Notebook driven development

  89. @dokun24 @mccoyjus The Jupyter Project • Notebook driven development •

    Easy to share experiments & documentation
  90. @dokun24 @mccoyjus The Jupyter Project • Notebook driven development •

    Easy to share experiments & documentation • Portable, web-based environment
  91. @dokun24 @mccoyjus Watson Studio

  92. @dokun24 @mccoyjus Watson Studio • Data science and IBM Cloud

  93. @dokun24 @mccoyjus Watson Studio • Data science and IBM Cloud

    • Democratizes the model training process
  94. @dokun24 @mccoyjus Watson Studio • Data science and IBM Cloud

    • Democratizes the model training process • Built on open source
  95. @dokun24 @mccoyjus Watson Studio • Data science and IBM Cloud

    • Democratizes the model training process • Built on open source • No native support for Swift…yet
  96. @dokun24 @mccoyjus Swift - Forked

  97. @dokun24 @mccoyjus Swift - Forked

  98. @dokun24 @mccoyjus Swift - Forked

  99. @dokun24 @mccoyjus Swift - Forked +

  100. @dokun24 @mccoyjus Python Swift Swift Swift

  101. @dokun24 @mccoyjus Swift Swift Swift Swift

  102. @dokun24 @mccoyjus Demo

  103. @dokun24 @mccoyjus

  104. @dokun24 @mccoyjus

  105. @dokun24 @mccoyjus Memory Benchmarking

  106. @dokun24 @mccoyjus MB 0 175 350 525 700 Node.js Ruby

    Python Swift Memory Benchmarking
  107. @dokun24 @mccoyjus MB 0 175 350 525 700 Node.js Ruby

    Python Swift 658.324 Memory Benchmarking
  108. @dokun24 @mccoyjus MB 0 175 350 525 700 Node.js Ruby

    Python Swift 511.724 658.324 Memory Benchmarking
  109. @dokun24 @mccoyjus MB 0 175 350 525 700 Node.js Ruby

    Python Swift 280.624 511.724 658.324 Memory Benchmarking
  110. @dokun24 @mccoyjus MB 0 175 350 525 700 Node.js Ruby

    Python Swift 192.436 280.624 511.724 658.324 Memory Benchmarking
  111. @dokun24 @mccoyjus Speed Benchmarking

  112. @dokun24 @mccoyjus Seconds 0 25 50 75 100 Node.js Ruby

    Python Swift Speed Benchmarking
  113. @dokun24 @mccoyjus Seconds 0 25 50 75 100 Node.js Ruby

    Python Swift 45.41 Speed Benchmarking
  114. @dokun24 @mccoyjus Seconds 0 25 50 75 100 Node.js Ruby

    Python Swift 50.97 45.41 Speed Benchmarking
  115. @dokun24 @mccoyjus Seconds 0 25 50 75 100 Node.js Ruby

    Python Swift 93.55 50.97 45.41 Speed Benchmarking
  116. @dokun24 @mccoyjus Seconds 0 25 50 75 100 Node.js Ruby

    Python Swift 5.05 93.55 50.97 45.41 Speed Benchmarking
  117. @dokun24 @mccoyjus

  118. @dokun24 @mccoyjus Maybe We Should

  119. @dokun24 @mccoyjus References • https://benchmarksgame-team.pages.debian.net/ benchmarksgame/performance/binarytrees.html • https://console.bluemix.net • https://dataplatform.ibm.com

    • https://swift.org • https://ibm.biz/iswift4tensorflow
  120. @dokun24 @mccoyjus Thank you!!!