Slide 1

Slide 1 text

A journey into Frameworks and Swift September 2016

Slide 2

Slide 2 text

Pedro Piñera @pepibumur [email protected] Matej Balantič @skavt [email protected]

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

● Architecture ● Test coverage ● Coupled ● From iOS 3

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

● Reactive ● Fully tested ● Reusable code

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

Reusing code Local pods Podfile

Slide 14

Slide 14 text

CocoaPods && !Versioning Conflicts changing between branches 1

Slide 15

Slide 15 text

Messy Dependency Graph Too many horizontal dependencies 2

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

Everyone touching everything Conflicts everywhere

Slide 20

Slide 20 text

Growing platforms 2007 2016

Slide 21

Slide 21 text

Scaling up the team

Slide 22

Slide 22 text

Scaling up the team

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Swift Platform Independent Reduce conflicts Compatible with all the Apple platforms: iOS, tvOS, macOS, watchOS Avoid unnecessary overhead when working with the new setup. Opportunity to start coding Swift. Objc public interface. Vertical dependencies Simple dependency graph that aims vertical dependency over horizontal. Goals

Slide 25

Slide 25 text

How?

Slide 26

Slide 26 text

iOS tvOS watchOS Core UI

Slide 27

Slide 27 text

iOS tvOS watchOS Core UI

Slide 28

Slide 28 text

iOS tvOS watchOS Core UI ● Shared models. ● Architectural components. ● Tooling ○ Accessing the Core Data ○ Networking layer ● Colors ● Fonts ● Custom Views

Slide 29

Slide 29 text

iOS tvOS watchOS Core UI API Config API Config ● Base URL ● HTTP Headers ● Session token

Slide 30

Slide 30 text

iOS tvOS watchOS Core UI API Config API Config ● Base URL ● HTTP Headers ● Session token Tooling

Slide 31

Slide 31 text

iOS tvOS watchOS Core UI Logging Analytics Fabric

Slide 32

Slide 32 text

Search iOS Core UI tvOS watchOS ...

Slide 33

Slide 33 text

Search iOS Core UI tvOS watchOS SearchiOS SearchtvOS ...

Slide 34

Slide 34 text

Search iOS Core UI tvOS watchOS Payments SearchiOS SearchtvOS Offline ...

Slide 35

Slide 35 text

Search iOS Core UI tvOS watchOS Payments SearchiOS SearchtvOS Offline ...

Slide 36

Slide 36 text

Are not reusable among platforms XIBs/Storyboards Platform reusability

Slide 37

Slide 37 text

FeatureCore (Business Logic) Platform independent feature Using frameworks FeatureiOS FeaturetvOS FeaturemacOS FeaturetvOS Feature

Slide 38

Slide 38 text

⋁ ⋁ “A good target number of dynamic frameworks to have is about half a dozen.” WWDC 2016 - Optimizing Startup Time

Slide 39

Slide 39 text

FeatureCore (Business Logic) Platform independent feature Alternative: Using Macros Feature Presentation (Views in code)

Slide 40

Slide 40 text

Search iOS Core UI tvOS watchOS SearchiOS SearchtvOS Offline ... App Core Data Offline Database App Keychain

Slide 41

Slide 41 text

Search iOS UI tvOS watchOS SearchiOS SearchtvOS Offline ... App Core Data Offline Database App Keychain Core DB Wrapper

Slide 42

Slide 42 text

Search iOS UI tvOS watchOS SearchiOS SearchtvOS Offline ... App Core Data Offline Database App Keychain Core DB Wrapper Stream Stream Database

Slide 43

Slide 43 text

Benefits ● Fully vertical features. ○ Almost no dependendencies between teams. ● Cleaner data models. Concerns ● Migration time. ● Deletion cascading. Alternatives ● 1 shared with independent tables. ● Dynamically generated merging models. Independent databases Each feature its own database

Slide 44

Slide 44 text

Tooling

Slide 45

Slide 45 text

Example projects To play with your Frameworks

Slide 46

Slide 46 text

Ensuring multi-platform compatibility With Fastlane Thanks Felix #yatusabes

Slide 47

Slide 47 text

Playgrounds Easy onboarding Thanks Apple #yatusabes

Slide 48

Slide 48 text

Epilogue (There’s no epilogue)

Slide 49

Slide 49 text

● Find if it works for you. ○ Team structure/size? ○ Supported platforms/targets? ○ Need to enforce good practices? ● Be aware of the downsides: ○ Xcode still has a long way to go ○ More than 6 dynamic frameworks are discouraged. Are Frameworks for me?

Slide 50

Slide 50 text

● Framework oriented programming Link ● Library oriented programming Link ● Building modern frameworks Link ● How to create a Framework for iOS Link ● The unofficial guide to xcconfig files Link ● Static or dynamic libraries Link ● Framework vs library Link ● Micro Features Architecture for iOS Link This slides http://bit.ly/2cTYsrv References

Slide 51

Slide 51 text

Gracias Questions? @skavt | @pepibumur (thanks to @LenartLeo for amazing journey map)