인프런 커뮤니티 질문&답변
형변환 할 때 사용하는 as!와 as?의 차이점이 무엇인가요?
작성
·
334
답변 2
0
0
뭐하는거니?
지식공유자
as?는 optional value 그대로 형변환 하는거구요.
as!는 unwrapping 하면서 형변환 하는 겁니다. iBook 에 나오면 내용은 아래와 같습니다. The conditional form, as?, returns an optional value of the type you are trying to downcast to. The forced form, as!, attmpts the downcast and force-unwraps the result as a single compound action.
as!는 unwrapping 하면서 형변환 하는 겁니다. iBook 에 나오면 내용은 아래와 같습니다. The conditional form, as?, returns an optional value of the type you are trying to downcast to. The forced form, as!, attmpts the downcast and force-unwraps the result as a single compound action.





