일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- WidgetTree
- ImageSlider
- UIKit
- colorofdays
- stanford
- IOS
- 오늘의 색상
- 프로젝트회고
- 새싹후기
- flutter
- 백준
- 알고리즘
- 조건문
- SwiftUI
- 스위프트
- Swift
- flutter #state # stateful #stateless
- Masil
- CS193p
- MVVM
- 프로그래머스
- process
- xcode
- 스터디
- collectionView
- 코딩테스트
- 청년취업사관학교후기
- xml
- GIT
- UserDefault
Archives
- Today
- Total
목록isempty (1)
개발을 시작하는 이야기

Swift 스터디에 참여해서 첫 자기소개 시간들을 갖게 되었는데 공유된 글에서 흥미로운 내용이 있어서 정리해둘겸 가져오게 되었다. Swift에서 set, array, string을 사용하면서 값이 비어있는 경우를 추적할때 보통 다음과 같은 코드를 사용하곤 한다. let string = "" if string.count == 0 { print("There are no String") } string의 길이를 체크해서 0인 경우를 판단하는 코드로 위 코드만으로도 정상적으로 작동한다. 하지만 더 보기 좋고 깔끔하고 효율적인 코드가 있다. let string = "" if string.isEmpty { print("string is Empty") } 스위프트의 String 타입에서 count 대신 isEmpty..
개발 이야기/Swift
2022. 5. 16. 19:10