Build Once Use Everywhere

Build Once Use Everywhere

Reuse your code across platforms in order to build apps for all of Apple's App Stores!

This talk was given at UIKonf 2016.

9f63c98d741c8130adb71db3bbf77f08?s=128

Dasmer

May 23, 2016
Tweet

Transcript

  1. BUILD ONCE USE EVERYWHERE DASMER SINGH @DASMERSINGH

  2. HISTORY

  3. 1984 APPLE RELEASES MACINTOSH

  4. 2007 APPLE RELEASES IPHONE

  5. 2011 APPLE RELEASES IPAD

  6. 2015 APPLE RELEASES APPLE WATCH AND APPLE TV 4

  7. None
  8. 2016 SO WHERE ARE WE TODAY?

  9. MOST APPS ARE WRITTEN ON IOS > 2.3 million iOS

    Apps 1 > 10,000+ Apple Watch apps2 > 1,000+ Apple TV apps3 > 30,000 Mac Apps1 1 (May 2016) Appshopper 3 (Nov 2015) DigitalTrends 2 (Sept 2015) TechCrunch
  10. WRITING APPS FOR OTHER PLATFORMS IS PROBABLY MUCH EASIER THAN

    YOU THINK...
  11. WRITING APPS FOR OTHER PLATFORMS IS PROBABLY MUCH EASIER THAN

    YOU THINK... 1. You already know Swift 2. You already know many core frameworks
  12. COMMONLY USED IOS FRAMEWORKS ALREADY ON TVOS > UIKit >

    Foundation > Core Location > CoreData > MapKit > SpriteKit > AVFoundation > Core Media > Media Player > Many, many more
  13. COMMONLY USED IOS FRAMEWORKS ALREADY ON WATCHOS > Foundation >

    Core Motion > Core Location > CoreData > HealthKit > HomeKit > PassKit > Contacts
  14. COMMONLY USED IOS FRAMEWORKS ALREADY ON OS X > Foundation

    > CoreData > Contacts > AddressBook
  15. OVERLAPPING FRAMEWORKS ENABLE US TO SHARE CODE

  16. SHARING CODE 1. Reduces redundancy 2. Avoids duplicate tests and

    documentation 3. Makes your code more modular
  17. EXAMPLE GILT APP FOR OS X, IOS, WATCHOS, AND TVOS

  18. STEPS 1. Write an API Wrapper Framework -> GiltKit 2.

    Create a new target and add the appropriate OS specific UI logic for each OS 3. Add GiltKit to each target and use it to display a list of upcoming sales.
  19. GILTKIT HEADER PREVIEW public struct Client { public init(session: NSURLSession

    = default) public func listSalesForStore(store: GiltKit.Store, kind: GiltKit.Sale.Kind, completion: (([GiltKit.Sale]) -> ())) } public struct Sale { public enum Kind : String { case Upcoming case Active } public let name: String public let description: String public let imageURL: NSURL public let size: UInt public let store: GiltKit.Store } public enum Store : String { case Men case Women case Kids case Home }
  20. None
  21. SHARING CODE IS POWERFUL

  22. THANK YOU @DASMERSINGH HTTP://GITHUB.COM/DASMER/ GILTKIT