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
Mode offline Cocoaheads
Search
Mathieu Hausherr
May 17, 2018
Technology
100
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Mode offline Cocoaheads
Mathieu Hausherr
May 17, 2018
More Decks by Mathieu Hausherr
See All by Mathieu Hausherr
Mobilis In Mobile 2024 - iOS, Android et la voiture - État des lieux
mhausherr
0
110
FrenchKit - Contact Tracing & Exposure Notification
mhausherr
0
230
FRAUG StopCovid19 : Le point sur les applications de tracing Bluetooth
mhausherr
1
290
Swift Lille - CoreML / CreateML
mhausherr
0
120
Image classification in real world : Car rental damage report
mhausherr
0
110
Les surcouches constructeur sur Android
mhausherr
1
900
Mode offline : Notre application Android fonctionne au niveau -5 d’un parking
mhausherr
0
1.5k
Mode offline : Notre application mobile fonctionne au niveau -5 d’un parking
mhausherr
1
160
CocoaHeads : Apple Pay
mhausherr
0
95
Other Decks in Technology
See All in Technology
TypeScript入門 2026
recruitengineers
PRO
3
690
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.2k
老害フォレンジッカーはAI羊の夢を見るか?
tadmaddad
0
350
ガバメント AI 源内を地方自治体は活用できるのか可能性と課題、期待について
takeda_h
2
450
私がブラウザを自作したくなった理由
supurazako
1
270
MulticaとPi Coding Agentで、小規模OSSを30本同時運用した流れ
eiei114
0
130
小粒でもパワフルなJS Runtime Antjsについて
comamoca
0
100
強化学習「理論」入門
enakai00
3
3.6k
Bits AI を制するものは Datadog を制す / The player that controls Bits AI, controls Datadog
kaminashi
0
130
Master Dataグループ紹介資料
sansan33
PRO
1
4.8k
え?フロントエンドエンジニアの ワイがインフラも!?
puku0x
1
760
LLM・AIエージェントシステムベストプラクティス
shibuiwilliam
6
1.5k
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
490
Building Applications with DynamoDB
mza
96
7.2k
Leo the Paperboy
mayatellez
8
2.2k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
390
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
420
The SEO identity crisis: Don't let AI make you average
varn
0
530
Chasing Engaging Ingredients in Design
codingconduct
0
280
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
Transcript
CocoaHeads Mathieu Hausherr @mhausherr 1 https://www.youtube.com/watch?v=wc38XyAA43o
Mode offline Notre application fonctionne au niveau -5 d’un parking
2
3
4
5
6
7
8
9
10
X
12
13
14
X Version 0.0.1-alpha
16
17 Plus jamais ça !
X Cache all requests if !isNetworkReachable && readFromCache(handler) { return
} manager.request(baseURL + path, method: method, parameters: parameters, encoding: encoding) .validate() .responseJSON { response in switch response.result { case .failure(let error): self.readFromCache(handler) case .success: self.writeResponseToCache(response: response) } }
X Cache all requests if !isNetworkReachable && readFromCache(handler) { return
} manager.request(baseURL + path, method: method, parameters: parameters, encoding: encoding) .validate() .responseJSON { response in switch response.result { case .failure(let error): self.readFromCache(handler) case .success: self.writeResponseToCache(response: response) } }
X Cache all requests if !isNetworkReachable && readFromCache(handler) { return
} manager.request(baseURL + path, method: method, parameters: parameters, encoding: encoding) .validate() .responseJSON { response in switch response.result { case .failure(let error): self.readFromCache(handler) case .success: self.writeResponseToCache(response: response) } }
X Cache all requests if !isNetworkReachable && readFromCache(handler) { return
} manager.request(baseURL + path, method: method, parameters: parameters, encoding: encoding) .validate() .responseJSON { response in switch response.result { case .failure(let error): self.readFromCache(handler) case .success: self.writeResponseToCache(response: response) } }
X Cache strategies switch cacheMode { case .standard: if !isNetworkReachable
&& readFromCache(handler) { return } case .forceCache: readFromCache(handler); return case .twoStepLoading: readFromCache(handler) }
X Cache strategies switch cacheMode { case .standard: if !isNetworkReachable
&& readFromCache(handler) { return } case .forceCache: readFromCache(handler); return case .twoStepLoading: readFromCache(handler) }
X Cache strategies switch cacheMode { case .standard: if !isNetworkReachable
&& readFromCache(handler) { return } case .forceCache: readFromCache(handler); return case .twoStepLoading: readFromCache(handler) }
X cache before call call cache after call standard forceCache
noCache twoStepLoading
X Cache Swift func getData() -> Data? { try? Data(contentsOf:
cacheURL) } func set(data: Data) { try? data.write(to: cacheURL, options: [.atomic]) } var isCacheStillValid: Bool { guard let attributes = try? FileManager.default.attributesOfItem(atPath: pathForCacheFile) else { return false } guard let modificationDate = attributes[FileAttributeKey.modificationDate] as? Date else { return false } return self.cacheDuration - modificationDate.timeIntervalSinceNow > 0 }
X Cache Swift func getData() -> Data? { try? Data(contentsOf:
cacheURL) } func set(data: Data) { try? data.write(to: cacheURL, options: [.atomic]) } var isCacheStillValid: Bool { guard let attributes = try? FileManager.default.attributesOfItem(atPath: pathForCacheFile) else { return false } guard let modificationDate = attributes[FileAttributeKey.modificationDate] as? Date else { return false } return self.cacheDuration - modificationDate.timeIntervalSinceNow > 0 }
X
29 Bien joué les gars !
X Version 1.0.0
31
X Déclaration la plus rapide possible, image avec sha256 POST
/inspection [{ "created_at": …, "zone_id": …, "image_hash": … }]
33
X Notifications silencieuses iOS <key>UIBackgroundModes</key> <array> <string>remote-notification</string> </array>
X Version 1.1.0
36
X
X
X
X Image cache Swift class ImageCache { var inMemoryCache: [URL:
UIImage] = [:] func image(forURL url: URL) -> UIImage? { if let image = inMemoryCache[url] { return image } if let image = readImageFromCache(url) { inMemoryCache[urlString] = image; return image } else { return nil } } }
X Premiers retours utilisateurs
42
X
X
X
X Version 2.7.0
X 400 voitures 250 000 téléchargements
X Pour tester
49 Merci