Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DO NOT REPEAT YOURSELF
Search
Marco Sero
March 13, 2015
Programming
0
240
DO NOT REPEAT YOURSELF
Leverage the power of C++ and Djinni to write native cross platform code on iOS and Android
Marco Sero
March 13, 2015
Tweet
Share
More Decks by Marco Sero
See All by Marco Sero
Working on a Legacy App
marcosero
3
2.9k
Event Detection
marcosero
1
1.6k
Other Decks in Programming
See All in Programming
iOSの隠されたAPIを解明し、開発効率を向上させる方法/iOSDC24
noppefoxwolf
2
120
rbs-inlineを導入してYARDからRBSに移行する
euglena1215
1
200
What we keep in mind when migrating from Serverless Framework to AWS CDK and AWS SAM
kasacchiful
1
130
Wallet API, Verifier APIで実現するIDカード on iPhoneの世界
shitamori1272
1
320
私のEbitengineの第一歩
qt_luigi
0
410
Swiftで高速フーリエ変換してオーディオビジュアライザーを作る / iOSDC Japan 2024 Day1 Track D
kyome22
2
460
null or undefined
susisu
19
4k
これからの時代の新標準!SwiftTestingへの移行とトラブルシューティング
uetyo
0
440
Go Code Generation at newmo / 2024-08-27 #newmo_layerx_go
genkey6
0
510
状態管理ライブラリZustandの導入から運用まで
k1tikurisu
2
220
ECMAScript、Web標準の型はどう管理されているか / How ECMAScript and Web standards types are maintained
petamoriken
3
360
(非公開スライド追加)座談会 「Strict ConcurrencyとSwift 6が開く新時代: 私たちはどう生きるか?」
shiz
1
140
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
30
6.2k
BBQ
matthewcrist
83
9.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
359
18k
The Cult of Friendly URLs
andyhume
76
5.9k
Why Our Code Smells
bkeepers
PRO
333
56k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
502
140k
How To Stay Up To Date on Web Technology
chriscoyier
785
250k
5 minutes of I Can Smell Your CMS
philhawksworth
201
19k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
52k
Designing with Data
zakiwarfel
98
5k
Into the Great Unknown - MozCon
thekraken
28
1.4k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
88
15k
Transcript
DO NOT REPEAT YOURSELF
IOS AND ANDROID HAVE SOMETHING IN COMMON
C++
BUT USING IT... IT'S NOT GREAT
Objective-C++ on iOS JNI (Java Native Interface) on Android
UNTIL...
DJINNI BY
.djinni interface + C++ implementation Djinni JAVA AND OBJECTIVE-C INTERFACES
THE HACK
SHARED C++ IMAGE CACHE
DEFINE INTERFACE IN A .djinni FILE image_cache = interface +c
{ static create_with_path(path: string): image_cache; image_for_key(key: string): binary; save_image_for_key(key: string, image_data: binary); }
IMPLEMENT IT IN C++ shared_ptr<ImageCache> ImageCache::create_with_path(const std::string &path) { ...
} vector<uint8_t> ImageCache::image_for_key(const string &key) { ... } void ImageCache::save_image_for_key(const string &key, const vector<uint8_t> &image_data) { ... }
USE IT FROM OBJECTIVE-C id<YCCPImageCache> imageCache = [YCPPImageCacheCppProxy createWithPath:cachePath]; NSData
*imageData = [imageCache imageForKey:cacheKey]; [imageCache saveImageForKey:cacheKey imageData:imageData]; AND JAVA ImageCache imageCache = ImageCache.createWithPath(cachePath); byte[] imageBlob = this.imageCache.imageForKey(cacheKey); imageCache.saveImageForKey(cacheKey, imageBlob);
NEVER WRITE JNI AND OBJECTIVE-C++ AGAIN
SHARE NATIVE CODE BETWEEN PLATFORMS MORE EASILY
DO I RECOMMEND THIS?
NO AT LEAST FOR OUR APPS
THANK YOU.