ios개발/개념 정리
<스위프트> try catch
studying develop
2020. 3. 5. 14:32
<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.