본문 바로가기
Programming/Swift

[Swift] Set

by 생각하는달팽이 2016. 2. 10.

Swift provides three primary collection types, known as arrays, sets, and dictionaries, for storing collections of values. Arrays are ordered collections of values. Sets are unordered collections of unique values. Dictionaries are unordered collections of key-value associations.



시작하기에 앞서 다음은 Apple Document 에서 명시되어 있는 설명이다.

요약하면..


Array,: 정렬된 값들의 집합

Set : 정렬되지 않은 값들의 집합

Dictionary : 정렬되지 않은 key-value 관계형 집합



// 2016. 02. 10. Ruke.



var teams : Set<String>


var myBills : Set = ["electricity","water","internet"]


myBills.insert("cable")


myBills.remove("water")


myBills.removeAll(keepCapacity: false)


myBills.count


var ints : Set = [1,2,3]


ints.sort()


var orderInts = ints.sort()


반응형

'Programming > Swift' 카테고리의 다른 글

[Swift] Optional  (0) 2016.02.10
[Swift] Tuple  (0) 2016.02.10
[Swift] Dictionary  (0) 2016.02.10
[Swift] Array  (0) 2016.02.10
[Swift] 함수  (0) 2016.02.10