Tomáš Kohout: Jak zrychlit iOS vývoj pomocí Swift playgoundů

Post on 12-Apr-2017

44 views 0 download

transcript

TOMÁŠ KOHOUTiOS Developer, Ackee

Speeding up iOS development using Swift Playground

Swift is great but …

Migrations

the ABI is not stable

migrate with every version of

swift

large projects = days to weeks

for migration (2.3 to 3)

hopefully less breaking changes in future

Xcode

code completion sucks

refactoring non-existent

no plugins anymore

crashes

we can use emoticons in code

Build times

small application = 2 - 5 mins

large application (>2000 files) =

40 mins

incremental builds does not

always work

Feedback loop

1. Denial

2. Anger

3. Bargaining

4. Depression

5. Acceptance

RealityIdeal

1. Write code

2. Build

3. See result

Build times

Build time: 68 s

Build time: 27 s

Build time analyzerhttps://github.com/RobertGummesson/BuildTimeAnalyzer-for-Xcode

Code Injection

inject code in runtime

no need to rebuild the application

hard to setup

xcode plugin

https://github.com/johnno1962/injectionforxcode

Code Injection II

separate application

since iOS 10 - simulator only

easier to setup

still unreliable

http://johnholdsworth.com/injection.html

Swift playgrounds

test sample code

educational tool

prototype animations

Playground live view

Playground live view

since xcode 7.3

interactive

can display viewcontroller

Swift playgrounds

Swift playgrounds

isolate screens in playground pages

prototype much faster

mock state easily

Demohttps://github.com/AckeeCZ/ios-playgrounds-example

Kickstarter application

open sourced iOS application

26 playground pages

large code base

playgrounds starts in 10 - 20s

https://github.com/kickstarter/ios-oss

TDD

1. add a test

2. run the test to see it fail

3. make change to pass the test

4. run the test again until it passes

5. repeat

TDD in playground

you can also run tests in playground!

quick feedback

test in isolation

copy to your suite later

Demohttps://github.com/sshrpe/TDDSwiftPlayground

Limitations

only latest swift

debugging

no image literals

xcode support

Xcode support

Xcode 7.3 💜

Xcode 8.0 - 8.2.1 🔥

Xcode 8.3 💜

Xcode 9 ❔

Summary

long build times are bad

be aware of the compiler

code injection

isolate screens in playground pages

WWW.MDEVTALK.CZ

mdevtalk