SlideShare ist ein Scribd-Unternehmen logo
1 von 60
Downloaden Sie, um offline zu lesen
Still Sleeping
on KMM?
@emmakoko96
Who am I?
Emmanuel Kehinde
Mobile Engineer @Plume
Blog @emmanuelkehinde.io
...
@emmakoko96
Still Sleeping on Kotlin
Multiplatform Mobile?
@emmakoko96
Kotlin Multiplatform
@emmakoko96
Kotlin Multiplatform
Single codebase for the business logic of your apps
across multiple platforms, in pure kotlin.
@emmakoko96
Single codebase for the business
logic of your apps across multiple
platforms, in pure kotlin.
@emmakoko96
Kotlin Multiplatform
Mobile
@emmakoko96
Kotlin Multiplatform Mobile
Sharing mobile native code (Android, iOS)
@emmakoko96
Sharing mobile native code
(Android, iOS)
@emmakoko96
What KMM is
not
@emmakoko96
KMM is not
→ "cross-platform"
@emmakoko96
KMM is not
→ "cross-platform"
→ Common UI
@emmakoko96
KMM is not
→ "cross-platform"
→ Common UI
→ Dependent on a UI Toolkit
@emmakoko96
KMM is not
→ "cross-platform"
→ Common UI
→ Dependent on a UI Toolkit
→ Operating System Specific
@emmakoko96
What does it
look like?
@emmakoko96
Similar to a regular Java/Kotlin Module
@emmakoko96
Similar to a regular Java/Kotlin
Module
TwittaSave: https://github.com/emmanuelkehinde/
TwittaSave-Mobile
expect/actual keywords
@emmakoko96
// CommonMain
expect class TwitterApiLogger() : TwitterLogger {
override fun log(message: String)
}
@emmakoko96
// CommonMain
expect class TwitterApiLogger() : TwitterLogger {
override fun log(message: String)
}
// AndroidMain
actual class TwitterApiLogger: TwitterLogger {
actual override fun log(message: String) {
if (BuildConfig.DEBUG) {
Log.d("Network", message)
}
}
}
@emmakoko96
// CommonMain
expect class TwitterApiLogger() : TwitterLogger {
override fun log(message: String)
}
// iOSMain
actual class TwitterApiLogger: TwitterLogger {
actual override fun log(message: String) {
if (Platform.isDebugBinary) {
NSLog("%s", message)
}
}
}
@emmakoko96
A better alternative - Interface
@emmakoko96
// Common
interface TwitterCredentialsProvider {
var bearerToken: String
val consumerKey: String
val consumerSecret: String
}
@emmakoko96
// Common
interface TwitterCredentialsProvider {
var bearerToken: String
val consumerKey: String
val consumerSecret: String
}
// androidApp
object TwitterCredentialsDataProvider : TwitterCredentialsProvider {
override var bearerToken: String = String()
override val consumerKey: String
get() = BuildConfig.CONSUMER_KEY
override val consumerSecret: String
get() = BuildConfig.CONSUMER_SECRET
}
@emmakoko96
// Common
interface TwitterCredentialsProvider {
var bearerToken: String
val consumerKey: String
val consumerSecret: String
}
// iOSApp
class TwitterCredentialsDataProvider: TwitterCredentialsProvider {
static let shared: TwitterCredentialsProvider = TwitterCredentialsDataProvider()
private let infoDict: [String: Any]?
init() {
infoDict = Bundle.main.infoDictionary
}
var bearerToken: String = String()
var consumerKey: String {
return (infoDict?["TWITTER_CONSUMER_KEY"] as? String) ?? String()
}
var consumerSecret: String {
return (infoDict?["TWITTER_CONSUMER_SECRET"] as? String) ?? String()
}
}
@emmakoko96
Benefits of Interface
→ Platform specific code can be easily managed
→ Testing is easier as you can mock easily
→ Useful when handling concurrency with Kotlin
Native
@emmakoko96
Integration
Methods
@emmakoko96
Android
Module/Library integration
@emmakoko96
iOS
→ XCFramework
→ Cocoapods
→ Swift Package
@emmakoko96
Getting
Started with
KMM
@emmakoko96
Requirements
@emmakoko96
Requirements
→ Computer running MacOS, Windows or Linux
→ Android Studio 4.2 or later
@emmakoko96
KMM Documentation
@emmakoko96
Android Studio Plugin
@emmakoko96
Refactoring Existing
Project
@emmakoko96
Community
@emmakoko96
Community
→ Open source sample projects
(DroidconKotlin, PeopleInSpace, etc.)
Sample Projects - https://kotlinlang.org/docs/mobile/samples.html
Community
→ Open source sample projects
(DroidconKotlin, PeopleInSpace, etc.)
→ Kotlin Slack
Join Kotlin Slack - https://surveys.jetbrains.com/s3/kotlin-slack-sign-up
Community
→ Open source sample projects
(DroidconKotlin, PeopleInSpace, etc.)
→ Kotlin Slack
→ Kotlin issue tracker (YouTrack)
Kotlin Issue Tracker - https://youtrack.jetbrains.com/issues/KT
Community
→ Open source sample projects
(DroidconKotlin, PeopleInSpace, etc.)
→ Kotlin Slack
→ Kotlin issue tracker (YouTrack)
→ Github issues/releases
@emmakoko96
KMM Libraries
@emmakoko96
KMM Libraries
→ Ktor for network requests
→ Coroutines for asynchronous programming
→ SQLDelight for data storage
and lots more...
KMM Libraries - https://libs.kmp.icerock.dev/
The Good
@emmakoko96
The Good
→ Natively Integrated
@emmakoko96
The Good
→ Natively Integrated
→ Saves time
@emmakoko96
The Good
→ Natively Integrated
→ Saves time
→ Single source of truth
@emmakoko96
The not so
Good
@emmakoko96
The not so Good
→ Concurrency/Memory Management not fun
Blog Post: https://emmanuelkehinde.io/supporting-multithreaded-coroutines-in-a-kotlin-multiplatform-project
The not so Good
→ Concurrency/Memory Management not fun
→ Debugging from Xcode still a concern
Xcode Plugin: https://github.com/touchlab/xcode-kotlin
My Opinion?
@emmakoko96
Consider your team, project size and long term
maintenance
@emmakoko96
More Helpful Resources
@emmakoko96
More Helpful Resources
→ https://kotlinlang.org/docs/mobile/home.html
→ https://emmanuelkehinde.io/category/kotlin-
multiplatform/
→ https://github.com/emmanuelkehinde/
TwittaSave-Mobile
@emmakoko96
Thanks!
Twitter - @emmakoko96

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Hello elixir (and otp)
Hello elixir (and otp)Hello elixir (and otp)
Hello elixir (and otp)
 
Install Concourse CI with BOSH
Install Concourse CI with BOSHInstall Concourse CI with BOSH
Install Concourse CI with BOSH
 
Messaging Elixir
Messaging ElixirMessaging Elixir
Messaging Elixir
 
iOS Parallel Automation - Viktar Karanevich - Mobile Test Automation Meetup (...
iOS Parallel Automation - Viktar Karanevich - Mobile Test Automation Meetup (...iOS Parallel Automation - Viktar Karanevich - Mobile Test Automation Meetup (...
iOS Parallel Automation - Viktar Karanevich - Mobile Test Automation Meetup (...
 
iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...
iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...
iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...
 
Tamir Dresher - What’s new in ASP.NET Core 6
Tamir Dresher - What’s new in ASP.NET Core 6Tamir Dresher - What’s new in ASP.NET Core 6
Tamir Dresher - What’s new in ASP.NET Core 6
 
Ansible Configuration Management Tool 소개 및 활용
Ansible Configuration Management Tool 소개 및 활용 Ansible Configuration Management Tool 소개 및 활용
Ansible Configuration Management Tool 소개 및 활용
 
REST API with Elixir with Maru
REST API with Elixir with MaruREST API with Elixir with Maru
REST API with Elixir with Maru
 
BOSH / CF Deployment in modern ways #cf_tokyo
BOSH / CF Deployment in modern ways #cf_tokyoBOSH / CF Deployment in modern ways #cf_tokyo
BOSH / CF Deployment in modern ways #cf_tokyo
 
Ansible
AnsibleAnsible
Ansible
 
This is how we REST
This is how we RESTThis is how we REST
This is how we REST
 
DevOps - Infrastructure as Code by Andre Marcelo-Tanner
DevOps - Infrastructure as Code by Andre Marcelo-TannerDevOps - Infrastructure as Code by Andre Marcelo-Tanner
DevOps - Infrastructure as Code by Andre Marcelo-Tanner
 
Apigility – Lightning Fast API Development - OSSCamp 2014
Apigility – Lightning Fast API Development - OSSCamp 2014 Apigility – Lightning Fast API Development - OSSCamp 2014
Apigility – Lightning Fast API Development - OSSCamp 2014
 
XebiCon'16 : Fastlane : Automatisez votre vie (de développeur iOS) Par Jean-...
XebiCon'16 : Fastlane : Automatisez votre vie (de développeur iOS)  Par Jean-...XebiCon'16 : Fastlane : Automatisez votre vie (de développeur iOS)  Par Jean-...
XebiCon'16 : Fastlane : Automatisez votre vie (de développeur iOS) Par Jean-...
 
Ionic2
Ionic2Ionic2
Ionic2
 
Java 8 concurrency abstractions
Java 8 concurrency abstractionsJava 8 concurrency abstractions
Java 8 concurrency abstractions
 
Windows Containers - Microsoft Ignite The Tour
Windows Containers - Microsoft Ignite The TourWindows Containers - Microsoft Ignite The Tour
Windows Containers - Microsoft Ignite The Tour
 
Intro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetupIntro to-ansible-sep7-meetup
Intro to-ansible-sep7-meetup
 
Introduction to ansible galaxy
Introduction to ansible galaxyIntroduction to ansible galaxy
Introduction to ansible galaxy
 
electron for emberists
electron for emberistselectron for emberists
electron for emberists
 

Ähnlich wie Droidcon Nigeria 2021 - Still Sleeping on KMM?

Introduction to MonoTouch
Introduction to MonoTouchIntroduction to MonoTouch
Introduction to MonoTouch
Jonas Follesø
 
Modules or microservices?
Modules or microservices?Modules or microservices?
Modules or microservices?
Sander Mak (@Sander_Mak)
 

Ähnlich wie Droidcon Nigeria 2021 - Still Sleeping on KMM? (20)

Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
 
Why I ❤️ Kotlin Multiplatform (and want YOU to also ❤️ Kotlin Multiplatform)
Why I ❤️ Kotlin Multiplatform (and want YOU to also ❤️ Kotlin Multiplatform)Why I ❤️ Kotlin Multiplatform (and want YOU to also ❤️ Kotlin Multiplatform)
Why I ❤️ Kotlin Multiplatform (and want YOU to also ❤️ Kotlin Multiplatform)
 
DEF CON 27 - workshop - RICHARD GOLD - mind the gap
DEF CON 27 - workshop - RICHARD GOLD - mind the gapDEF CON 27 - workshop - RICHARD GOLD - mind the gap
DEF CON 27 - workshop - RICHARD GOLD - mind the gap
 
Introduction to MonoTouch
Introduction to MonoTouchIntroduction to MonoTouch
Introduction to MonoTouch
 
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
 
Xamarin.Mac Introduction
Xamarin.Mac IntroductionXamarin.Mac Introduction
Xamarin.Mac Introduction
 
Xamarin - Under the bridge
Xamarin - Under the bridgeXamarin - Under the bridge
Xamarin - Under the bridge
 
Tampere Docker meetup - Happy 5th Birthday Docker
Tampere Docker meetup - Happy 5th Birthday DockerTampere Docker meetup - Happy 5th Birthday Docker
Tampere Docker meetup - Happy 5th Birthday Docker
 
Xamarin Under The Hood - Dan Ardelean
 Xamarin Under The Hood - Dan Ardelean Xamarin Under The Hood - Dan Ardelean
Xamarin Under The Hood - Dan Ardelean
 
Infrastructure design for Kubernetes
Infrastructure design for KubernetesInfrastructure design for Kubernetes
Infrastructure design for Kubernetes
 
Everyone Loves Docker Containers Before They Understand Docker Containers - A...
Everyone Loves Docker Containers Before They Understand Docker Containers - A...Everyone Loves Docker Containers Before They Understand Docker Containers - A...
Everyone Loves Docker Containers Before They Understand Docker Containers - A...
 
Import golang; struct microservice
Import golang; struct microserviceImport golang; struct microservice
Import golang; struct microservice
 
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...
MuleSoft Surat Virtual Meetup#35 - Setting up MuleSoft Runtime and Anypoint C...
 
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCrossC# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
 
Make it compatible
Make it compatibleMake it compatible
Make it compatible
 
Open Source for You: Etherios Cloud Connector
Open Source for You: Etherios Cloud ConnectorOpen Source for You: Etherios Cloud Connector
Open Source for You: Etherios Cloud Connector
 
Open Source for You: Etherios Cloud Connector
Open Source for You: Etherios Cloud ConnectorOpen Source for You: Etherios Cloud Connector
Open Source for You: Etherios Cloud Connector
 
Writing Kotlin Multiplatform libraries that your iOS teammates are gonna love
Writing Kotlin Multiplatform libraries that your iOS teammates are gonna loveWriting Kotlin Multiplatform libraries that your iOS teammates are gonna love
Writing Kotlin Multiplatform libraries that your iOS teammates are gonna love
 
Modules or microservices?
Modules or microservices?Modules or microservices?
Modules or microservices?
 
Ci for i-os-codemash-01.2013
Ci for i-os-codemash-01.2013Ci for i-os-codemash-01.2013
Ci for i-os-codemash-01.2013
 

Kürzlich hochgeladen

Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
mbmh111980
 

Kürzlich hochgeladen (20)

AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
 
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
 
IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024
 
10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf
 
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCAOpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
 
The Impact of PLM Software on Fashion Production
The Impact of PLM Software on Fashion ProductionThe Impact of PLM Software on Fashion Production
The Impact of PLM Software on Fashion Production
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
What need to be mastered as AI-Powered Java Developers
What need to be mastered as AI-Powered Java DevelopersWhat need to be mastered as AI-Powered Java Developers
What need to be mastered as AI-Powered Java Developers
 
SQL Injection Introduction and Prevention
SQL Injection Introduction and PreventionSQL Injection Introduction and Prevention
SQL Injection Introduction and Prevention
 
CompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdfCompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdf
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
Naer Toolbar Redesign - Usability Research Synthesis
Naer Toolbar Redesign - Usability Research SynthesisNaer Toolbar Redesign - Usability Research Synthesis
Naer Toolbar Redesign - Usability Research Synthesis
 
how-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdfhow-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdf
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
Malaysia E-Invoice digital signature docpptx
Malaysia E-Invoice digital signature docpptxMalaysia E-Invoice digital signature docpptx
Malaysia E-Invoice digital signature docpptx
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024
 

Droidcon Nigeria 2021 - Still Sleeping on KMM?