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

A journey towards Frameworks and Swift

A journey towards Frameworks and Swift

The exciting journey of changing your project architecture basing it on Frameworks and allowing developers to start using Swift in the SoundCloud main app.

Since the launch of Swift in 2014 we had used Swift only in the SoundCloud watch app. The need of having reusable business logic among other reasons led to a new architecture for the project based on dynamic frameworks where Swift would be a first citizen member. In this talk we'll explain the approach we followed at SoundCloud to change our app architecture allowing developers to start using Swift in the project. Learnings, caveats, and how the project and the company has benefit from this journey.

Matej Balantič

September 15, 2016
Tweet

More Decks by Matej Balantič

Other Decks in Technology

Transcript

  1. 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
  2. iOS tvOS watchOS Core UI • Shared models. • Architectural

    components. • Tooling ◦ Accessing the Core Data ◦ Networking layer • Colors • Fonts • Custom Views
  3. iOS tvOS watchOS Core UI API Config API Config •

    Base URL • HTTP Headers • Session token
  4. iOS tvOS watchOS Core UI API Config API Config •

    Base URL • HTTP Headers • Session token Tooling
  5. ⋁ ⋁ “A good target number of dynamic frameworks to

    have is about half a dozen.” WWDC 2016 - Optimizing Startup Time
  6. Search iOS Core UI tvOS watchOS SearchiOS SearchtvOS Offline ...

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

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

    Core Data Offline Database App Keychain Core DB Wrapper Stream Stream Database
  9. 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
  10. • 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?
  11. • 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/soundcloud-frameworks References