Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- SWIFT
- 오블완
- modern concurrency
- WWDC
- 티스토리챌린지
- ios
- APNS
- modern concurrency deep dive
- 야곰 # 야곰아카데미커리어스타터캠프 #iOS개발자 # 부트캠프
Archives
- Today
- Total
Geon
Modern Concurrency Deep Dive(3) 본문
iOS developer essential skills/Modern Concurency
Modern Concurrency Deep Dive(3)
jgkim1008 2024. 11. 16. 23:51신규 URLSession API
- 기존 completion으로 복잡함으로 간단하게 변경할수 있다.
- Completion 누락등 휴먼 에러도 쉽게 찾아낼수 있다.
func fetch() try await -> User? {
do {
let url = URL(string: "www.test.com")
let response = try await URLSession.shared.data(from: url)
guard (response as? HTTPURLResponse)?.stateCode.contains(200..<299) else {
return nil
}
let user = try JSONDecoder().decode(User.self, from: data)
return user
} catch let error {
print(error)
throw error
}
}
'iOS developer essential skills > Modern Concurency' 카테고리의 다른 글
Modern Concurrency Deep Dive(6) (0) | 2024.11.19 |
---|---|
Modern Concurrency Deep Dive(5) (0) | 2024.11.18 |
Modern Concurrency Deep Dive(4) (0) | 2024.11.17 |
Modern Concurrency Deep Dive(2) (0) | 2024.11.15 |
Modern Concurrency Deep Dive(1) (0) | 2024.11.14 |