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
100
FrenchKit - Contact Tracing & Exposure Notification
mhausherr
0
230
FRAUG StopCovid19 : Le point sur les applications de tracing Bluetooth
mhausherr
1
280
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
150
CocoaHeads : Apple Pay
mhausherr
0
89
Other Decks in Technology
See All in Technology
AWS環境のセキュリティ不安を解消した企業事例 ~よくある課題と対策を一挙公開~
asanoharuki
1
270
Escolhendo LLMs na Prática: Lições Reais em Busca Agêntica no Mercado Livre —TDC 2026 Floripa
jpbonson
0
120
AIツールを導入しても生産性はあがらない? カオナビが直面した 3つの壁と乗り越え方。/ Overcoming 3 Barriers to AI-Driven Productivity at kaonavi
kaonavi
0
1.4k
SnowflakeCoCoでデータエンジニアリング!
foursue
0
110
Power Automateアップデート情報
miyakemito
0
290
WEBフロントエンド研修【MIXI 26新卒技術研修】
mixi_engineers
PRO
2
900
脱Jenkins、インターン生が挑んだCIツールGitHubActions移行
mixi_engineers
PRO
1
300
大 AI 時代におけるC# の事情 ~ぶっちゃけトークを交えながら~
nenonaninu
1
620
20260608_Codexの可能性_ノンプログラマー向け_大城追記
doradora09
PRO
0
720
MIRU 2026 チュートリアル
keisuke198619
0
440
セキュリティ研修【MIXI 26新卒技術研修】
mixi_engineers
PRO
32
27k
AI驚き屋発見器
yama3133
2
400
Featured
See All Featured
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
45k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
200
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Unsuck your backbone
ammeep
672
58k
The SEO Collaboration Effect
kristinabergwall1
1
510
The World Runs on Bad Software
bkeepers
PRO
72
12k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.6k
Test your architecture with Archunit
thirion
1
2.3k
Balancing Empowerment & Direction
lara
6
1.2k
Un-Boring Meetings
codingconduct
0
360
Embracing the Ebb and Flow
colly
88
5.1k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
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