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
クリぼっちの自分が信じられるのはもはや型のみである
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Ryota Sakaguchi
December 25, 2018
Technology
490
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
クリぼっちの自分が 信じられるのは もはや型のみである
Ryota Sakaguchi
December 25, 2018
More Decks by Ryota Sakaguchi
See All by Ryota Sakaguchi
大切なことは全てLintが教えてくれた
kuluna
0
58
時間を意識する推しツールたち / Time-aware tools
kuluna
1
640
DroidKaigi2020 - Data Bindingのイロハ
kuluna
1
1.5k
チームでつくる RESTful API
kuluna
1
12k
Other Decks in Technology
See All in Technology
「AIに依存している」と 「AIを使いこなしている」の違い
k8yasuma
0
100
誤解だらけの開発生産性 / Myths and Misconceptions about Developer Productivity
i35_267
2
760
シンガポールで登壇してきます
yama3133
0
230
Making sense of Google’s agentic dev tools
glaforge
1
260
AIコード生成×サプライチェーン攻撃 — PHPが直面する“二重の信頼問題
shinyasaita
0
170
AI、CDK と協働する Full TypeScript アプリケーション開発 / Full TypeScript Application with AI and CDK
geekplus_tech
2
310
「守りたい体験」を渡すだけで E2E を生成させられるようになった話
hinac0
0
130
壊して学ぶAWS CDK: そのcdk deployで消えるもの、残るもの
k_adachi_01
1
330
ソニー銀行におけるビジネスアジリティ向上のためのクラウドシフト戦略
srenext
0
550
関数型の考えを TypeScript に持ち込んで、テストしやすい純粋関数を増やす / Pure at the Core, Effects at the Edge: Bringing Functional Thinking into TypeScript
kaminashi
2
130
人を動かすのは時間ではなく、納得感 〜新任EMが入社3ヶ月、組織を2回変えた話〜
kakehashi
PRO
3
260
End-to-Endで考える信頼性 —LINEアプリにおけるクライアント開発×SRE連携の実践
maruloop
4
4.4k
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.5k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
260
Music & Morning Musume
bryan
47
7.3k
The Invisible Side of Design
smashingmag
301
52k
Done Done
chrislema
186
16k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
270
Facilitating Awesome Meetings
lara
57
7k
Prompt Engineering for Job Search
mfonobong
0
370
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
460
Navigating Weather and Climate Data
rabernat
0
350
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
950
Transcript
{ "shop": { "id": 1, "name": "", "employees": [ {
"id": 1, "job_id": 1, "name": "kuluna" } ] } }
import Foundation struct Employee: Decodable { let id: Int let
job_id: Int let name: String } struct Shop: Decodable { let id: Int let name: String let employees: [Employee] } struct ShopResponse: Decodable { let shop: Shop }
let response = try! JSONDecoder().decode( ShopResponse.self, from: json.data(using: .utf8)! )
print(response.shop.name) // “”
☺
let shop = response.shop shop.id == shop.employees.first?.job_id
let newEmployee = Employee( id: shop.id, job_id: 0, name: "Sakaguchi"
)
!
-
!
struct ShopId: Codable, Equatable { let value: Int init(_ value:
Int) { self.value = value } public init(from decoder: Decoder) throws { self.value = try decoder.singleValueContainer().decode(Int.self) } public func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() try c.encode(self.value) } }
struct Shop: Decodable { let id: ShopId let name: String
let employees: [Employee] }
☺ ☺ Comparable