SlideShare a Scribd company logo
1 of 29
Download to read offline
Building a LEGO ® app with CocoaPods
Playing with bricks
@artheyn @cocoanantes
Problematic
Build a new application which reuses a lot of core
functionalities of an existing one
2
Solutions
3
• Using git submodules
‣ Hard to maintain with a lot of dependencies
‣ Hard to manage a proper versioning for each module
‣ Easy to link
‣ Versioning management and locking for free
• Using a package manager
Overview
• Slicing the app: iAdvize App case study
4
• In practice: build & use bricks
• Pros & Cons
• The wrong way
• Our modules
• Conclusion
5
1. Identify the main app domains which will form our bricks
2. Separate each brick from the main app
3. Reconstruct the main app by linking the bricks together
Slicing the app
Steps
6
Step 1
In Search of Lost Bricks
User
Account
Login
Logger
…
…
…
…
……
7
CocoaPods
Quick Reminder
PodfileApp
App
Workspace
Pods
Podfile
pod install
8
App Pods
Workspace
Podfile
Step 2
Splitting the app into bricks
App Pods
Podfile
Login
Workspace
Login
9
Step 2
Extracting the bricks
App Pods
Podfile
Login
Workspace
Pods
Workspace
Podfile
Login
10
Step 2
Extracting the bricks
App Pods
Workspace
Podfile
Login Pods
Workspace
Podfile
Auth Pods
Workspace
Podfile
…
11
Step 2
App Structure
App
UI Tests
App
Sources
App
Tests
App
12
Step 2
Module Structure
Login
UI Tests
Login
Sources
Login
Tests
Login

Integration

App
Sources
Login
13
• Using an internal pod repo
‣ Useful for strict versioning
‣ Useless if you want to point a dependency directly to a branch
• Using direct git repository link with a specific branch
pod 'iAdvizeLoggerLibrary', :git => 'ssh://(…)/mobile-ios-logger-library.git', :branch => 'master'
Step 3
Rebuild with CocoaPods
Two different ways to manage dependencies:
14
App Pods
Workspace
Podfile
Login
Podspec
Step 3
Rebuild with Cocoapods
:branch => ‘master’
15
Sample of a Podfile in the main application
def app_pods
# COCOAPODS EXTERNAL DEPENDENCIES
# HTTP requests.
pod 'Alamofire', '~> 4.0'
# (…)
# COCOAPODS INTERNAL DEPENDENCIES
# User service (user-related data storage)
pod 'iAdvizeUserService', :git => 'ssh://git@github.com/iadvize/mobile-ios-user-service.git', :branch => 'master'
# Account service (user profile)
pod 'iAdvizeAccountService', :git => 'ssh://git@github.com/iadvize/mobile-ios-account-service.git', :branch => 'master'
# Components library (reusable UI components)
pod 'iAdvizeComponentsLibrary', :git => 'ssh://git@github.com/iadvize/mobile-ios-components-library.git', :branch => 'master'
end
Step 3
Rebuild with Cocoapods
In practice
16
CocoaPods and the power of the `path`
App
Podfile
Login
Workspace
Pods
Workspace
Podfile
Pods
pod 'iAdvizeLoginService', :path => '../mobile-ios-login-service'
:path => ‘../login’
Login
In practice
17
CocoaPods and the power of the `path`
• Editing directly module files in the main app workspace like
if the module was directly in your app
‣ Impossible with Carthage!
• Test locally the integration of a module in the main app
In practice
18
Module creation
Login
PodspecPodfile
Module
Sources
App
1
2
3
4
Podfile
:path => ‘../module’
:branch => ‘master’
In practice
19
Module usage
pod 'iAdvizeConversationService', :git => ‘ssh://(…)/mobile-ios-conversation-service.git’, :branch => 'master'
1. Add module dependency in the Podfile
2. Import, configure and use your module in your app
import iAdvizeConversationService
ConversationServiceManager.shouldDisplayPrincipalImageInChat = true
let conversationRootViewController = ConversationServiceManager.initialViewController() as! UISplitViewController
addControllerToTabBar(conversationRootViewController, at: 0)
In practice
20
Application: Orchestrator of modules
• Almost empty and deserves as a module orchestrator
• Instantiates, configures and displays each module
• Observes modules events (notifications) and actions
(delegate)
• Can forward events between modules
In practice
21
Module: Reusable brick
• Contains all the sources of a domain (including tests)
• Exposes events that apps or modules can observe
• Provides a way to configure it
• Provides an initial view controller (if it contains some UI)
• In a separate project
Git workflows
22
In our applications
‣ git-flow
In our modules
‣ “github like” workflow working with master, feature branches and tags
for production versions
Pros
23
• Fully separated and reusable modules
‣ Helps to have a proper architecture and avoid duplications
• Each module has its own Xcode project so it can be developed, run
and tested independently (without integrating it in a main application)
‣ Can even be shipped as a single module app for acceptance tests
• Lighter Xcode project which means low build time when you work on
a module
• Easy to integrate with the CocoaPods local link (path)
• Even if we don’t use strict versioning, we get the benefits of module
version locking with the Podfile.lock
• More modules -> more chance you have to work alone at a time ->
less conflicts
Cons
24
• Some configuration files has to be duplicated
‣ Continuous integration, lint, localizables, run scripts…
• Multiple Podspec and Podfile to work with and maintain
• Switching module dependency from remote repository to local
sources and vice versa has to be done manually in the Podfile
pod 'iAdvizeLoggerLibrary', :git => ‘(…)mobile-ios-logger-library.git’, :branch => 'master'
pod 'iAdvizeLoggerLibrary', :path => ‘../mobile-ios-logger-library’
Our modules
25
Spreading ideas
User
Account
Authentication
CommonUI
ComponentsConversation
Livefeed
Logger
Login
Stats
PushNotifs
Tracking
Utils
The Wrong Way
26
(For us)
• Using an Internal Cocoapods specs repository was not relevant
‣ Use the git repository direct link feature of CocoaPods and point to a
specific branch
• Trying to use strict versioning on modules can quickly turn into a
nightmare
‣ No versioning is applied to our modules. The Podfile.lock prevent from
accidental updates and as we own our dependencies we are full aware of
break changes
• Applying a complex git workflow in the modules repositories is time-
consuming
‣ Using a single branch with tags for versions in production seems to be
the best solution
Conclusion
27
Great and straightforward mobile architecture approach even
for small applications which helps you to think your code in
terms of reusable bricks.
Just taste it!
Bibliography
28
http://product.hubspot.com/blog/architecting-a-large-ios-
app-with-cocoapods
Thank you!
29
Questions?
@artheyn @SimonLiotier

More Related Content

What's hot

BlaBlaCar et la mise en place d'une fonctionnalité FlagFeature
BlaBlaCar et la mise en place d'une fonctionnalité FlagFeatureBlaBlaCar et la mise en place d'une fonctionnalité FlagFeature
BlaBlaCar et la mise en place d'une fonctionnalité FlagFeatureCocoaHeads France
 
Continuous integration by Rémy Virin
Continuous integration by Rémy VirinContinuous integration by Rémy Virin
Continuous integration by Rémy VirinCocoaHeads France
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React NativePolidea
 
What's New in JHipsterLand - Devoxx Poland 2017
What's New in JHipsterLand - Devoxx Poland 2017What's New in JHipsterLand - Devoxx Poland 2017
What's New in JHipsterLand - Devoxx Poland 2017Matt Raible
 
CocoaHeads Rennes #13 : CocoaPods
CocoaHeads Rennes #13 : CocoaPodsCocoaHeads Rennes #13 : CocoaPods
CocoaHeads Rennes #13 : CocoaPodsCocoaHeadsRNS
 
Using JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsUsing JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsYakov Fain
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Matt Raible
 
Fastlane - Automation and Continuous Delivery for iOS Apps
Fastlane - Automation and Continuous Delivery for iOS AppsFastlane - Automation and Continuous Delivery for iOS Apps
Fastlane - Automation and Continuous Delivery for iOS AppsSarath C
 
WordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQLWordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQLhouzman
 
Deploy your app with one Slack command
Deploy your app with one Slack commandDeploy your app with one Slack command
Deploy your app with one Slack commandFabio Milano
 
Amsterdam.js talk: node webkit
Amsterdam.js talk: node webkitAmsterdam.js talk: node webkit
Amsterdam.js talk: node webkitFabian Jakobs
 
Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Bootiful Development with Spring Boot and Angular - Spring I/O 2017Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Bootiful Development with Spring Boot and Angular - Spring I/O 2017Matt Raible
 
Qtws19 how-to-build-qml-app-for-webos
Qtws19 how-to-build-qml-app-for-webosQtws19 how-to-build-qml-app-for-webos
Qtws19 how-to-build-qml-app-for-weboswebOSEvangelist
 
Cross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkitCross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkitWittawas Wisarnkanchana
 
slide-dnrdw
slide-dnrdwslide-dnrdw
slide-dnrdwYue Liu
 
Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)
Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)
Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)Eddie Lau
 

What's hot (20)

Cocoa pods
Cocoa podsCocoa pods
Cocoa pods
 
BlaBlaCar et la mise en place d'une fonctionnalité FlagFeature
BlaBlaCar et la mise en place d'une fonctionnalité FlagFeatureBlaBlaCar et la mise en place d'une fonctionnalité FlagFeature
BlaBlaCar et la mise en place d'une fonctionnalité FlagFeature
 
Continuous integration by Rémy Virin
Continuous integration by Rémy VirinContinuous integration by Rémy Virin
Continuous integration by Rémy Virin
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
What's New in JHipsterLand - Devoxx Poland 2017
What's New in JHipsterLand - Devoxx Poland 2017What's New in JHipsterLand - Devoxx Poland 2017
What's New in JHipsterLand - Devoxx Poland 2017
 
React Ecosystem
React EcosystemReact Ecosystem
React Ecosystem
 
CocoaHeads Rennes #13 : CocoaPods
CocoaHeads Rennes #13 : CocoaPodsCocoaHeads Rennes #13 : CocoaPods
CocoaHeads Rennes #13 : CocoaPods
 
Using JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsUsing JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot apps
 
React native
React nativeReact native
React native
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017
 
Fastlane - Automation and Continuous Delivery for iOS Apps
Fastlane - Automation and Continuous Delivery for iOS AppsFastlane - Automation and Continuous Delivery for iOS Apps
Fastlane - Automation and Continuous Delivery for iOS Apps
 
WordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQLWordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQL
 
Deploy your app with one Slack command
Deploy your app with one Slack commandDeploy your app with one Slack command
Deploy your app with one Slack command
 
Amsterdam.js talk: node webkit
Amsterdam.js talk: node webkitAmsterdam.js talk: node webkit
Amsterdam.js talk: node webkit
 
Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Bootiful Development with Spring Boot and Angular - Spring I/O 2017Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Bootiful Development with Spring Boot and Angular - Spring I/O 2017
 
Qtws19 how-to-build-qml-app-for-webos
Qtws19 how-to-build-qml-app-for-webosQtws19 how-to-build-qml-app-for-webos
Qtws19 how-to-build-qml-app-for-webos
 
Cross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkitCross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkit
 
slide-dnrdw
slide-dnrdwslide-dnrdw
slide-dnrdw
 
Gdg ionic 2
Gdg ionic 2Gdg ionic 2
Gdg ionic 2
 
Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)
Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)
Native Desktop App with Node.js Webkit (HTML, CSS & Javascript)
 

Viewers also liked

Programme MFI retour d'expérience
Programme MFI retour d'expérienceProgramme MFI retour d'expérience
Programme MFI retour d'expérienceCocoaHeads France
 
How to communicate with Smart things?
How to communicate with Smart things?How to communicate with Smart things?
How to communicate with Smart things?CocoaHeads France
 
La sécurité sur iOS par Arnaud de Bock
La sécurité sur iOS par Arnaud de BockLa sécurité sur iOS par Arnaud de Bock
La sécurité sur iOS par Arnaud de BockNicolas Lourenço
 
Comment faire de HLS votre solution vidéo préférée ?
Comment faire de HLS votre solution vidéo préférée ?Comment faire de HLS votre solution vidéo préférée ?
Comment faire de HLS votre solution vidéo préférée ?CocoaHeads France
 
Safari app extensions cleared up by Sanaa Squalli
Safari app extensions cleared up by Sanaa SqualliSafari app extensions cleared up by Sanaa Squalli
Safari app extensions cleared up by Sanaa SqualliCocoaHeads France
 
MVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire LhotelierMVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire LhotelierCocoaHeads France
 
Découvrir dtrace en ligne de commande.
Découvrir dtrace en ligne de commande.Découvrir dtrace en ligne de commande.
Découvrir dtrace en ligne de commande.CocoaHeads France
 
Firebase par nicolas lehovetzki
Firebase par nicolas lehovetzkiFirebase par nicolas lehovetzki
Firebase par nicolas lehovetzkiCocoaHeads France
 
Un retour d'expérience sur Apple Pay
Un retour d'expérience sur Apple PayUn retour d'expérience sur Apple Pay
Un retour d'expérience sur Apple PayCocoaHeads France
 
J'ai fait une app native en React Native
J'ai fait une app native en React NativeJ'ai fait une app native en React Native
J'ai fait une app native en React NativeCocoaHeads France
 

Viewers also liked (20)

Let's migrate to Swift 3.0
Let's migrate to Swift 3.0Let's migrate to Swift 3.0
Let's migrate to Swift 3.0
 
BitTorrent on iOS
BitTorrent on iOSBitTorrent on iOS
BitTorrent on iOS
 
Project Entourage
Project EntourageProject Entourage
Project Entourage
 
CloudKit as a backend
CloudKit as a backendCloudKit as a backend
CloudKit as a backend
 
What's new in iOS9
What's new in iOS9What's new in iOS9
What's new in iOS9
 
Présentation de HomeKit
Présentation de HomeKitPrésentation de HomeKit
Présentation de HomeKit
 
Programme MFI retour d'expérience
Programme MFI retour d'expérienceProgramme MFI retour d'expérience
Programme MFI retour d'expérience
 
SwiftyGPIO
SwiftyGPIOSwiftyGPIO
SwiftyGPIO
 
How to communicate with Smart things?
How to communicate with Smart things?How to communicate with Smart things?
How to communicate with Smart things?
 
IoT Best practices
 IoT Best practices IoT Best practices
IoT Best practices
 
La sécurité sur iOS par Arnaud de Bock
La sécurité sur iOS par Arnaud de BockLa sécurité sur iOS par Arnaud de Bock
La sécurité sur iOS par Arnaud de Bock
 
Comment faire de HLS votre solution vidéo préférée ?
Comment faire de HLS votre solution vidéo préférée ?Comment faire de HLS votre solution vidéo préférée ?
Comment faire de HLS votre solution vidéo préférée ?
 
Safari app extensions cleared up by Sanaa Squalli
Safari app extensions cleared up by Sanaa SqualliSafari app extensions cleared up by Sanaa Squalli
Safari app extensions cleared up by Sanaa Squalli
 
MVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire LhotelierMVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire Lhotelier
 
Découvrir dtrace en ligne de commande.
Découvrir dtrace en ligne de commande.Découvrir dtrace en ligne de commande.
Découvrir dtrace en ligne de commande.
 
Firebase par nicolas lehovetzki
Firebase par nicolas lehovetzkiFirebase par nicolas lehovetzki
Firebase par nicolas lehovetzki
 
Quoi de neuf dans iOS 10.3
Quoi de neuf dans iOS 10.3Quoi de neuf dans iOS 10.3
Quoi de neuf dans iOS 10.3
 
Un retour d'expérience sur Apple Pay
Un retour d'expérience sur Apple PayUn retour d'expérience sur Apple Pay
Un retour d'expérience sur Apple Pay
 
J'ai fait une app native en React Native
J'ai fait une app native en React NativeJ'ai fait une app native en React Native
J'ai fait une app native en React Native
 
Alamofire
AlamofireAlamofire
Alamofire
 

Similar to Build a lego app with CocoaPods

Cocoapods in action
Cocoapods in actionCocoapods in action
Cocoapods in actionHan Qin
 
Manage your external libraries with CocoaPods
Manage your external libraries with CocoaPodsManage your external libraries with CocoaPods
Manage your external libraries with CocoaPodsJuan C Catalan
 
Building static libraries for iOS with CocoaPods
Building static libraries for iOS with CocoaPodsBuilding static libraries for iOS with CocoaPods
Building static libraries for iOS with CocoaPodsSigmapoint
 
I pad uicatalog_lesson02
I pad uicatalog_lesson02I pad uicatalog_lesson02
I pad uicatalog_lesson02Rich Helton
 
iOS Application Security
iOS Application SecurityiOS Application Security
iOS Application SecurityEgor Tolstoy
 
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...Kobkrit Viriyayudhakorn
 
DevHub 3 - Composer plus Magento
DevHub 3 - Composer plus MagentoDevHub 3 - Composer plus Magento
DevHub 3 - Composer plus MagentoMagento Dev
 
DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2Docker, Inc.
 
Building Top-Notch Androids SDKs
Building Top-Notch Androids SDKsBuilding Top-Notch Androids SDKs
Building Top-Notch Androids SDKsrelayr
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Gil Irizarry
 
Desktop apps with node webkit
Desktop apps with node webkitDesktop apps with node webkit
Desktop apps with node webkitPaul Jensen
 
State ofappdevelopment
State ofappdevelopmentState ofappdevelopment
State ofappdevelopmentgillygize
 
Building production-quality apps with Node.js
Building production-quality apps with Node.jsBuilding production-quality apps with Node.js
Building production-quality apps with Node.jsmattpardee
 
Intro to Ionic for Building Hybrid Mobile Applications
Intro to Ionic for Building Hybrid Mobile ApplicationsIntro to Ionic for Building Hybrid Mobile Applications
Intro to Ionic for Building Hybrid Mobile ApplicationsSasha dos Santos
 
Practicing AppDevKit in kata training
Practicing AppDevKit in kata trainingPracticing AppDevKit in kata training
Practicing AppDevKit in kata traininganistar sung
 
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Molieremfrancis
 
Infinum android talks_10_android_libraries_used_on_daily_basis
Infinum android talks_10_android_libraries_used_on_daily_basisInfinum android talks_10_android_libraries_used_on_daily_basis
Infinum android talks_10_android_libraries_used_on_daily_basisInfinum
 

Similar to Build a lego app with CocoaPods (20)

Cocoapods in action
Cocoapods in actionCocoapods in action
Cocoapods in action
 
Manage your external libraries with CocoaPods
Manage your external libraries with CocoaPodsManage your external libraries with CocoaPods
Manage your external libraries with CocoaPods
 
Building static libraries for iOS with CocoaPods
Building static libraries for iOS with CocoaPodsBuilding static libraries for iOS with CocoaPods
Building static libraries for iOS with CocoaPods
 
I pad uicatalog_lesson02
I pad uicatalog_lesson02I pad uicatalog_lesson02
I pad uicatalog_lesson02
 
iOS Application Security
iOS Application SecurityiOS Application Security
iOS Application Security
 
Private pod support using cocoa pods in ios
Private pod support using cocoa pods in iosPrivate pod support using cocoa pods in ios
Private pod support using cocoa pods in ios
 
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
 
DevHub 3 - Composer plus Magento
DevHub 3 - Composer plus MagentoDevHub 3 - Composer plus Magento
DevHub 3 - Composer plus Magento
 
DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2
 
Building Top-Notch Androids SDKs
Building Top-Notch Androids SDKsBuilding Top-Notch Androids SDKs
Building Top-Notch Androids SDKs
 
Gradle Again
Gradle AgainGradle Again
Gradle Again
 
Revue des annonces WWDC2015
Revue des annonces WWDC2015Revue des annonces WWDC2015
Revue des annonces WWDC2015
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
 
Desktop apps with node webkit
Desktop apps with node webkitDesktop apps with node webkit
Desktop apps with node webkit
 
State ofappdevelopment
State ofappdevelopmentState ofappdevelopment
State ofappdevelopment
 
Building production-quality apps with Node.js
Building production-quality apps with Node.jsBuilding production-quality apps with Node.js
Building production-quality apps with Node.js
 
Intro to Ionic for Building Hybrid Mobile Applications
Intro to Ionic for Building Hybrid Mobile ApplicationsIntro to Ionic for Building Hybrid Mobile Applications
Intro to Ionic for Building Hybrid Mobile Applications
 
Practicing AppDevKit in kata training
Practicing AppDevKit in kata trainingPracticing AppDevKit in kata training
Practicing AppDevKit in kata training
 
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
 
Infinum android talks_10_android_libraries_used_on_daily_basis
Infinum android talks_10_android_libraries_used_on_daily_basisInfinum android talks_10_android_libraries_used_on_daily_basis
Infinum android talks_10_android_libraries_used_on_daily_basis
 

More from CocoaHeads France

Mutation testing for a safer Future
Mutation testing for a safer FutureMutation testing for a safer Future
Mutation testing for a safer FutureCocoaHeads France
 
Visual accessibility in iOS11
Visual accessibility in iOS11Visual accessibility in iOS11
Visual accessibility in iOS11CocoaHeads France
 
My script - One year of CocoaHeads
My script - One year of CocoaHeadsMy script - One year of CocoaHeads
My script - One year of CocoaHeadsCocoaHeads France
 
Ui testing dealing with push notifications
Ui testing dealing with push notificationsUi testing dealing with push notifications
Ui testing dealing with push notificationsCocoaHeads France
 
CONTINUOUS DELIVERY WITH FASTLANE
CONTINUOUS DELIVERY WITH FASTLANECONTINUOUS DELIVERY WITH FASTLANE
CONTINUOUS DELIVERY WITH FASTLANECocoaHeads France
 
L'intégration continue avec Bitrise
L'intégration continue avec BitriseL'intégration continue avec Bitrise
L'intégration continue avec BitriseCocoaHeads France
 

More from CocoaHeads France (11)

Mutation testing for a safer Future
Mutation testing for a safer FutureMutation testing for a safer Future
Mutation testing for a safer Future
 
iOS App Group for Debugging
iOS App Group for DebuggingiOS App Group for Debugging
iOS App Group for Debugging
 
Asynchronous swift
Asynchronous swiftAsynchronous swift
Asynchronous swift
 
Visual accessibility in iOS11
Visual accessibility in iOS11Visual accessibility in iOS11
Visual accessibility in iOS11
 
My script - One year of CocoaHeads
My script - One year of CocoaHeadsMy script - One year of CocoaHeads
My script - One year of CocoaHeads
 
Ui testing dealing with push notifications
Ui testing dealing with push notificationsUi testing dealing with push notifications
Ui testing dealing with push notifications
 
CONTINUOUS DELIVERY WITH FASTLANE
CONTINUOUS DELIVERY WITH FASTLANECONTINUOUS DELIVERY WITH FASTLANE
CONTINUOUS DELIVERY WITH FASTLANE
 
L'intégration continue avec Bitrise
L'intégration continue avec BitriseL'intégration continue avec Bitrise
L'intégration continue avec Bitrise
 
Super combinators
Super combinatorsSuper combinators
Super combinators
 
Design like a developer
Design like a developerDesign like a developer
Design like a developer
 
Handle the error
Handle the errorHandle the error
Handle the error
 

Recently uploaded

Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 

Recently uploaded (20)

Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 

Build a lego app with CocoaPods

  • 1. Building a LEGO ® app with CocoaPods Playing with bricks @artheyn @cocoanantes
  • 2. Problematic Build a new application which reuses a lot of core functionalities of an existing one 2
  • 3. Solutions 3 • Using git submodules ‣ Hard to maintain with a lot of dependencies ‣ Hard to manage a proper versioning for each module ‣ Easy to link ‣ Versioning management and locking for free • Using a package manager
  • 4. Overview • Slicing the app: iAdvize App case study 4 • In practice: build & use bricks • Pros & Cons • The wrong way • Our modules • Conclusion
  • 5. 5 1. Identify the main app domains which will form our bricks 2. Separate each brick from the main app 3. Reconstruct the main app by linking the bricks together Slicing the app Steps
  • 6. 6 Step 1 In Search of Lost Bricks User Account Login Logger … … … … ……
  • 8. 8 App Pods Workspace Podfile Step 2 Splitting the app into bricks App Pods Podfile Login Workspace Login
  • 9. 9 Step 2 Extracting the bricks App Pods Podfile Login Workspace Pods Workspace Podfile Login
  • 10. 10 Step 2 Extracting the bricks App Pods Workspace Podfile Login Pods Workspace Podfile Auth Pods Workspace Podfile …
  • 11. 11 Step 2 App Structure App UI Tests App Sources App Tests App
  • 12. 12 Step 2 Module Structure Login UI Tests Login Sources Login Tests Login
 Integration
 App Sources Login
  • 13. 13 • Using an internal pod repo ‣ Useful for strict versioning ‣ Useless if you want to point a dependency directly to a branch • Using direct git repository link with a specific branch pod 'iAdvizeLoggerLibrary', :git => 'ssh://(…)/mobile-ios-logger-library.git', :branch => 'master' Step 3 Rebuild with CocoaPods Two different ways to manage dependencies:
  • 14. 14 App Pods Workspace Podfile Login Podspec Step 3 Rebuild with Cocoapods :branch => ‘master’
  • 15. 15 Sample of a Podfile in the main application def app_pods # COCOAPODS EXTERNAL DEPENDENCIES # HTTP requests. pod 'Alamofire', '~> 4.0' # (…) # COCOAPODS INTERNAL DEPENDENCIES # User service (user-related data storage) pod 'iAdvizeUserService', :git => 'ssh://git@github.com/iadvize/mobile-ios-user-service.git', :branch => 'master' # Account service (user profile) pod 'iAdvizeAccountService', :git => 'ssh://git@github.com/iadvize/mobile-ios-account-service.git', :branch => 'master' # Components library (reusable UI components) pod 'iAdvizeComponentsLibrary', :git => 'ssh://git@github.com/iadvize/mobile-ios-components-library.git', :branch => 'master' end Step 3 Rebuild with Cocoapods
  • 16. In practice 16 CocoaPods and the power of the `path` App Podfile Login Workspace Pods Workspace Podfile Pods pod 'iAdvizeLoginService', :path => '../mobile-ios-login-service' :path => ‘../login’ Login
  • 17. In practice 17 CocoaPods and the power of the `path` • Editing directly module files in the main app workspace like if the module was directly in your app ‣ Impossible with Carthage! • Test locally the integration of a module in the main app
  • 19. In practice 19 Module usage pod 'iAdvizeConversationService', :git => ‘ssh://(…)/mobile-ios-conversation-service.git’, :branch => 'master' 1. Add module dependency in the Podfile 2. Import, configure and use your module in your app import iAdvizeConversationService ConversationServiceManager.shouldDisplayPrincipalImageInChat = true let conversationRootViewController = ConversationServiceManager.initialViewController() as! UISplitViewController addControllerToTabBar(conversationRootViewController, at: 0)
  • 20. In practice 20 Application: Orchestrator of modules • Almost empty and deserves as a module orchestrator • Instantiates, configures and displays each module • Observes modules events (notifications) and actions (delegate) • Can forward events between modules
  • 21. In practice 21 Module: Reusable brick • Contains all the sources of a domain (including tests) • Exposes events that apps or modules can observe • Provides a way to configure it • Provides an initial view controller (if it contains some UI) • In a separate project
  • 22. Git workflows 22 In our applications ‣ git-flow In our modules ‣ “github like” workflow working with master, feature branches and tags for production versions
  • 23. Pros 23 • Fully separated and reusable modules ‣ Helps to have a proper architecture and avoid duplications • Each module has its own Xcode project so it can be developed, run and tested independently (without integrating it in a main application) ‣ Can even be shipped as a single module app for acceptance tests • Lighter Xcode project which means low build time when you work on a module • Easy to integrate with the CocoaPods local link (path) • Even if we don’t use strict versioning, we get the benefits of module version locking with the Podfile.lock • More modules -> more chance you have to work alone at a time -> less conflicts
  • 24. Cons 24 • Some configuration files has to be duplicated ‣ Continuous integration, lint, localizables, run scripts… • Multiple Podspec and Podfile to work with and maintain • Switching module dependency from remote repository to local sources and vice versa has to be done manually in the Podfile pod 'iAdvizeLoggerLibrary', :git => ‘(…)mobile-ios-logger-library.git’, :branch => 'master' pod 'iAdvizeLoggerLibrary', :path => ‘../mobile-ios-logger-library’
  • 26. The Wrong Way 26 (For us) • Using an Internal Cocoapods specs repository was not relevant ‣ Use the git repository direct link feature of CocoaPods and point to a specific branch • Trying to use strict versioning on modules can quickly turn into a nightmare ‣ No versioning is applied to our modules. The Podfile.lock prevent from accidental updates and as we own our dependencies we are full aware of break changes • Applying a complex git workflow in the modules repositories is time- consuming ‣ Using a single branch with tags for versions in production seems to be the best solution
  • 27. Conclusion 27 Great and straightforward mobile architecture approach even for small applications which helps you to think your code in terms of reusable bricks. Just taste it!