Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 포켓볼
- swift
- IOS
- 아이폰7
- 얻는법
- 스마트폰
- LG유플러스
- simulator
- loop
- UIView
- afterdelay
- 신도림 테크노마트
- setting
- 앱스토어
- swift3
- GCD
- 페이백
- 공략
- error
- 포켓몬 GO
- 샘플
- Example
- Bitcode
- Check
- UITableView
- 해몽
- 신도림
- 보라카이
- push
- Xcode
Archives
- Today
- Total
도래울
swift for문 index알기 본문
Yes. As of Swift 2.0, if you need the index for each element along with its value, you can use the enumerate()
method to iterate over the array. It returns a tuple composed of the index and the value for each item in the array. For example:
for (index, element) in list.enumerate() {
print("Item \(index): \(element)")
}
Prior to Swift 2.0, enumerate
was a global function.
for (index, element) in enumerate(list) {
println("Item \(index): \(element)")
}
'개발 > iOS' 카테고리의 다른 글
none of the input catalogs contained a matching launch image set named brand assets 에러 (0) | 2016.06.14 |
---|---|
swift uitableview cell insert delete crash (0) | 2016.06.07 |
swift uilabel multi color, font (0) | 2016.05.23 |
swift alert ios8 example (0) | 2016.05.23 |
UITextField 에서 Money Format 자동완성 하기 (0) | 2016.05.23 |