- abs(-1) == 1
- abs(-42) == 42
- abs(42) == 42
- var languages = ["Swift", "Objective-C"]
- contains(languages, "Swift") == true
- contains(languages, "Java") == false
- contains([29, 85, 42, 96, 75], 42) == true
- var languages = ["Swift", "Objective-C"]
- var oldLanguages = dropFirst(languages)
- equal(oldLanguages, ["Objective-C"]) == true
- var languages = ["Swift", "Objective-C"]
- var newLanguages = dropLast(languages)
- equal(newLanguages, ["Swift"]) == true
- var languages = ["Swift", "Objective-C"]
- dump(languages)
- // Prints:
- // ? 2 elements
- // - [0]: Swift
- // - [1]: Objective-C
- var languages = ["Swift", "Objective-C"]
- equal(languages, ["Swift", "Objective-C"]) == true
- var oldLanguages = dropFirst(languages)
- equal(oldLanguages, ["Objective-C"]) == true
- for i in filter(1...100, { $0 % 10 == 0 })
- {
- // 10, 20, 30, ...
- println(i)
- assert(contains([10, 20, 30, 40, 50, 60, 70, 80, 90, 100], i))
- }
- var languages = ["Swift", "Objective-C"]
- find(languages, "Objective-C") == 1
- find(languages, "Java") == nil
- find([29, 85, 42, 96, 75], 42) == 2
- equal(indices([29, 85, 42]), [0, 1, 2])
- for i in indices([29, 85, 42]) {
- // 0, 1, 2
- println(i)
- }
- join(":", ["A", "B", "C"]) == "A:B:C"
- var languages = ["Swift", "Objective-C"]
- join("/", languages) == "Swift/Objective-C"
- equal(map(1...3, { $0 * 5 }), [5, 10, 15])
- for i in map(1...10, { $0 * 10 }) {
- // 10, 20, 30, ...
- println(i)
- assert(contains([10, 20, 30, 40, 50, 60, 70, 80, 90, 100], i))
- }
- max(0, 1) == 1
- max(8, 2, 3) == 8
- maxElement(1...10) == 10
- var languages = ["Swift", "Objective-C"]
- maxElement(languages) == "Swift"
- minElement(1...10) == 1
- var languages = ["Swift", "Objective-C"]
- minElement(languages) == "Objective-C"
- var languages = ["Swift", "Objective-C"]
- reduce(languages, "", { $0 + $1 }) == "SwiftObjective-C"
- reduce([10, 20, 5], 1, { $0 * $1 }) == 1000
- equal(reverse([1, 2, 3]), [3, 2, 1])
- for i in reverse([1, 2, 3]) {
- // 3, 2, 1
- println(i)
- }
- startsWith("foobar", "foo") == true
- startsWith(10..100, 10..15) == true
- var languages = ["Swift", "Objective-C"]
- startsWith(languages, ["Swift"]) == true
- abs(...)
- advance(...)
- alignof(...)
- alignofValue(...)
- assert(...)
- bridgeFromObjectiveC(...)
- bridgeFromObjectiveCUnconditional(...)
- bridgeToObjectiveC(...)
- bridgeToObjectiveCUnconditional(...)
- c_malloc_size(...)
- c_memcpy(...)
- c_putchar(...)
- contains(...)
- count(...)
- countElements(...)
- countLeadingZeros(...)
- debugPrint(...)
- debugPrintln(...)
- distance(...)
- dropFirst(...)
- dropLast(...)
- dump(...)
- encodeBitsAsWords(...)
- enumerate(...)
- equal(...)
- filter(...)
- find(...)
- getBridgedObjectiveCType(...)
- getVaList(...)
- indices(...)
- insertionSort(...)
- isBridgedToObjectiveC(...)
- isBridgedVerbatimToObjectiveC(...)
- isUniquelyReferenced(...)
- join(...)
- lexicographicalCompare(...)
- map(...)
- max(...)
- maxElement(...)
- min(...)
- minElement(...)
- numericCast(...)
- partition(...)
- posix_read(...)
- posix_write(...)
- print(...)
- println(...)
- quickSort(...)
- reduce(...)
- reflect(...)
- reinterpretCast(...)
- reverse(...)
- roundUpToAlignment(...)
- sizeof(...)
- sizeofValue(...)
- sort(...)
- split(...)
- startsWith(...)
- strideof(...)
- strideofValue(...)
- swap(...)
- swift_MagicMirrorData_summaryImpl(...)
- swift_bufferAllocate(...)
- swift_keepAlive(...)
- toString(...)
- transcode(...)
- underestimateCount(...)
- unsafeReflect(...)
- withExtendedLifetime(...)
- withObjectAtPlusZero(...)
- withUnsafePointer(...)
- withUnsafePointerToObject(...)
- withUnsafePointers(...)
- withVaList(...)
原文地址:http://blog.csdn.net/oshirdey/article/details/32969399