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

Swift for Distributed Teams

Swift for Distributed Teams

Wayde Gradwell

November 06, 2017
Tweet

Other Decks in Programming

Transcript

  1. • Storyboards • Localisations • TableViews • Local Images •

    AppDelegate • API Structure • Promises • Compilation Improvements
  2. • Allows multiple developers to work on the UI without

    having merge conflicts • Use Storyboard References to link Storyboards • Separate your storyboards into Categories • With a ViewController selected, choose Editor -> “Refactor to Storyboard” to move existing ViewControllers
  3. • Use ’prepareForInterfaceBuilder’ method to setup your view • Makes

    finding UI elements easier • Testing layout with actual data If reusing views, use a library such as NibDesignable to help with displaying your view in a Storyboard
  4. • Can be difficult to find out where all localisations

    are used • As these are String based, its easy for errors to occur over time • Need to look at the string itself to determine how it is used, and if it takes any parameters
  5. • Using Enums gives you strong typing and compile time

    checking • Using associated value with Enums lets other developers know when a parameter is needed • Namespaces your localisations to provide a logical grouping of strings
  6. • Use enums to specify types of cells • Cleans

    up your ViewController code • The intention of the code is clearer • Makes Unit testing easier
  7. • Over time the amount of code in AppDelegate increases

    • Difficult to remember what every line of code does • Different libraries may require you to have code in didFinishLaunchingWithOptions and didReceiveRemoteNotification The solution is to use PluggableApplicationDelegate which allows you to treat each library as a service.
  8. • Swift is prone to slow compilation times • Type

    inference does a good job, however it can struggle at times
  9. • Swift is prone to slow compilation times • Type

    inference does a good job, however it can struggle at times Xcode 9 has a new compiler flag: -warn-long-expression-type- checking=x
  10. Apple recommends using Whole Module Optimization for your debug builds

    However this increases your compilation times vs using ‘Onone’