<https://codewithchris.com/swift-try-catch/>
do try catch로 구성하면 되는 거였다.
do – This keyword starts the block of code that contains the method that can potentially throw an error.
try – You must use this keyword in front of the method that throws. Think of it like this: “You’re trying to execute the method.
catch – If the throwing method fails and raises an error, the execution will fall into this catch block. This is where you’ll write code display a graceful error message to the user.
Use this pattern to handle any potential errors caused by a method that throws.
'ios개발 > 개념 정리' 카테고리의 다른 글
<스위프트> dispatchQueue , dispatchGroup (0) | 2020.03.05 |
---|---|
<스위프트> typealias (0) | 2020.03.05 |
<스위프트> class vs struct (0) | 2020.03.05 |
<스위프트> dismiss : Viewcontroller dismiss (0) | 2020.03.04 |
<스위프트> 뷰컨트롤러 이동 1 : transition, present, show (0) | 2020.03.04 |