跳到主要内容

📖Swift 参考手册

📖Swift 参考手册

Swift 字符串方法

  1. Swift 字符串 contains() 方法 Checks if specified string is present in a string
  2. Swift 字符串 remove() 方法 removes a character in the string
  3. Swift 字符串 append() 方法 adds a string value to another string
  4. Swift 字符串 insert() 方法 inserts a new character value into the string
  5. Swift 字符串 hasPrefix() 方法 checks if string begins with the specified string
  6. Swift 字符串 hasSuffix() 方法 checks if string ends with the specified string
  7. Swift 字符串 uppercased() 方法 converts all characters in the string to uppercase
  8. Swift 字符串 lowercased() 方法 converts all characters in the string to lowercase
  9. Swift 字符串 split() 方法 breaks up a string at the specified separator
  10. Swift 字符串 removeAll() 方法 removes elements from string based on condition
  11. Swift 字符串 trimmingCharacters() 方法 removes whitespace from both ends of a string
  12. Swift 字符串 joined() 方法 return string with elements separated by separator
  13. Swift 字符串 elementsEqual() 方法 checks if two strings are equal
  14. Swift 字符串 replacingOccurrences() 方法 replace all matching characters in the string
  15. Swift 字符串 dropFirst() 方法 removes the first character of the string
  16. Swift 字符串 dropLast() 方法 removes the last character of the string
  17. Swift 字符串 reversed() 方法 reverses the given string

Swift 数组方法

  1. Swift 数组 insert() 方法 inserts an element to the array
  2. Swift 数组 append() 方法 inserts a new element at the end of the array
  3. Swift 数组 contains() 方法 checks whether the element is present or not
  4. Swift数组remove()方法 removes an element from the array
  5. Swift数组sort()方法 sorts the elements of an array in a specific order
  6. Swift数组removeAll()方法 removes all the elements from the array
  7. Swift数组的min()方法 returns the minimum element in the array
  8. Swift数组的max()方法 returns the maximum element in the array
  9. Swift数组的reverse()方法 reverse the order of an array
  10. Swift数组的joined()方法 return string with elements separated by separator
  11. Swift数组的removeLast()方法 removes the last element from the array
  12. Swift数组的dropFirst()方法 drops the first element
  13. Swift数组的dropLast()方法 drops the last element in the array
  14. Swift数组的swapAt()方法 swaps two elements in an array
  15. Swift数组的removeSubrange()方法 removes elements present in specified indices
  16. Swift数组的shuffle()方法 shuffles all the elements of an array
  17. Swift数组的prefix()方法 returns specified number of elements from first
  18. Swift数组的suffix()方法 returns specified number of elements from last
  19. Swift数组的allSatisfy()方法 returns Bool based on given condition
  20. Swift数组的filter()方法 returns elements that satisfy given condition
  21. Swift数组的map()方法 transforms the array
  22. Swift数组的isEmpty属性 checks if the array is empty or not
  23. Swift数组的count属性 returns the total number of elements present
  24. Swift数组的capacity属性 returns number of elements
  25. Swift数组的first属性 returns the first element of array
  26. Swift数组的last属性 returns the last element of the array

Swift字典方法

  1. Swift字典的removeAll()方法 removes all key-value pairs from the dictionary
  2. Swift字典的randomElement()方法 returns a random key-value pair from dictionary
  3. Swift字典的mapValues()方法 transforms all values of dictionary
  4. Swift字典的contains()方法 checks whether key or value is present or not
  5. Swift 字典 enumerated() 方法 iterates through key-value pairs of a dictionary
  6. Swift 字典 filter() 方法 returns elements that satisfy given condition
  7. Swift 字典 forEach() 方法 iterates through each element of a dictionary
  8. Swift 字典 max() 方法 returns the max key-value pair in the dictionary
  9. Swift 字典 min() 方法 returns the min key-value pair in the dictionary
  10. Swift 字典 removeValue() 方法 removes the certain key and its associated value
  11. Swift 字典 sorted() 方法 sorts the dictionary in a specific order
  12. Swift 字典 updateValue() 方法 updates the value for the given key
  13. Swift 字典 isEmpty 属性 checks if the dictionary is empty or not
  14. Swift 字典 count 属性 returns the total number of elements present
  15. Swift 字典 capacity 属性 returns the total number of elements
  16. Swift 字典 keys 属性 returns just the keys of the dictionary
  17. Swift 字典 first 属性 returns the first key/value pair

Swift 集合方法

  1. Swift 集合 contains() 方法 checks if specified element is present or not
  2. Swift 集合 filter() 方法 returns all elements that satisfies the condition
  3. Swift 集合 forEach() 方法 iterate through each element of a set
  4. Swift 集合 formIntersection() 方法 forms intersection between two sets
  5. Swift 集合 formUnion() 方法 inserts elements of the given sequence into set
  6. Swift 集合 insert() 方法 inserts a new element at the end of the set
  7. Swift 集合 intersection() 方法 returns new set with elements common to both sets
  8. Swift 集合 isDisjoint() 方法 returns true if two sets are disjoint sets
  9. Swift 集合 isSubset() 方法 returns true if one set is subset of other
  10. Swift 集合 isSuperset() 方法 returns true if a set is superset of other set
  11. Swift 集合 max() 方法 returns the maximum element in the set
  12. Swift集合的min()方法 returns the minimum element in the set
  13. Swift集合的remove()方法 removes the specified element from the set
  14. Swift集合的removeAll()方法 removes elements from set based on a condition
  15. Swift集合的removeFirst()方法 removes the first element from the set
  16. Swift集合的shuffled()方法 shuffles all the elements of a set
  17. Swift集合的sorted()方法 sorts the elements of the set in a specific order
  18. Swift集合的subtract()方法 returns the set difference of two sets
  19. Swift集合的union()方法 returns a new set with distinct elements
  20. Swift集合的update()方法 inserts the given element in the set
  21. Swift集合的isEmpty属性 checks if the set is empty or not
  22. Swift集合的count属性 returns the total number of elements present
  23. Swift集合的first属性 returns the first element of array

Swift Double方法

  1. Swift Double的abs()方法 returns the absolute value
  2. Swift Double的isEqual()方法 checks if one number is equal to another
  3. Swift Double的isLess()方法 checks if one number is less than another
  4. Swift Double的isLessThanOrEqualTo()方法 checks if number is less than or equal to another
  5. Swift Double的isMultiple()方法 checks if one number is multiple of another
  6. Swift Double的maximum()方法 returns the maximum of the two given values
  7. Swift Double的minimum()方法 returns the minimum of the two given values
  8. Swift Double的remainder()方法 computes the floating point remainder
  9. Swift Double的rounded()方法 rounds the specified value to the closest int
  10. Swift Double squareRoot()方法 returns the square root
  11. Swift Double quotientAndRemainder()方法 calculates the quotient and remainder