원하는 loop 만들기 : stride 사용
// x부터 y까지 i를 -1해가며 for문 수행
for i in stride(from: x, through: y, by: -1) {
// code
}
Set : 중복 X
// 생성
var set = Set<String>()
// 추가
set.insert("A")
// 포함 여부
set.contains("A")
// 비우기
set = []
'iOS > Swift' 카테고리의 다른 글
[Swift] super.init()은 언제 호출해야할까 (0) | 2022.11.29 |
---|---|
[Swift] Swift 알고리즘 - 수학 (0) | 2022.10.13 |
[Swift] Swift 알고리즘 - Dictionary (0) | 2022.10.12 |
[Swift] Swift 알고리즘 - 문자열 / 배열 (0) | 2022.10.11 |
[Swift] 클로저 (Closure) (0) | 2022.09.24 |