-
카테고리
-
세부 분야
모바일 앱 개발
-
해결 여부
미해결
형변환 할 때 사용하는 as!와 as?의 차이점이 무엇인가요?
16.07.19 23:38 작성 조회수 117
0
제가 optional value, unwrapping을 이해할 때에 헷갈리는 부분이 있어서 그런 것인지 as!와 as?의 차이점이 잘 와닿지 않는 것 같습니다. 혹시 좀 정리해주실 수 있나요?
답변을 작성해보세요.
0
0
뭐하는거니?
지식공유자2016.07.20
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.
답변 2