273
273
/// }
274
274
/// }
275
275
/// // Prints "Response 200: OK"
276
- /// // Prints "Response 403: Access Forbidden "
276
+ /// // Prints "Response 403: Access forbidden "
277
277
/// // Prints "Unknown response 301"
278
278
///
279
279
/// You can also update, modify, or remove keys and values from a dictionary
351
351
/// the corresponding key-value pair as a non-optional tuple.
352
352
///
353
353
/// print(imagePaths[glyphIndex!])
354
- /// // Prints "("star", "/glyphs/star.png")"
354
+ /// // Prints "(key: "star", value: "/glyphs/star.png")"
355
355
///
356
356
/// A dictionary's indices stay valid across additions to the dictionary as
357
357
/// long as the dictionary has enough capacity to store the added values
@@ -696,7 +696,7 @@ extension Dictionary: Collection {
696
696
/// } else {
697
697
/// print("Didn't find 'Japan' as a value in the dictionary.")
698
698
/// }
699
- /// // Prints "("JP", "Japan")"
699
+ /// // Prints "(key: "JP", value: "Japan")"
700
700
/// // Prints "Japan's country code is 'JP'."
701
701
///
702
702
/// - Parameter position: The position of the key-value pair to access.
@@ -851,7 +851,7 @@ extension Dictionary {
851
851
/// print("Response \(code): \(message)")
852
852
/// }
853
853
/// // Prints "Response 200: OK"
854
- /// // Prints "Response 403: Access Forbidden "
854
+ /// // Prints "Response 403: Access forbidden "
855
855
/// // Prints "Response 301: Unknown response"
856
856
///
857
857
/// When a dictionary's `Value` type has value semantics, you can use this
@@ -862,7 +862,7 @@ extension Dictionary {
862
862
/// let message = "Hello, Elle!"
863
863
/// var letterCounts: [Character: Int] = [:]
864
864
/// for letter in message {
865
- /// letterCounts[letter, defaultValue : 0] += 1
865
+ /// letterCounts[letter, default : 0] += 1
866
866
/// }
867
867
/// // letterCounts == ["H": 1, "e": 2, "l": 4, "o": 1, ...]
868
868
///
@@ -933,7 +933,7 @@ extension Dictionary {
933
933
/// let data = ["a": "1", "b": "three", "c": "///4///"]
934
934
///
935
935
/// let m: [String: Int?] = data.mapValues { str in Int(str) }
936
- /// // ["a": 1 , "b": nil, "c": nil]
936
+ /// // ["a": Optional(1) , "b": nil, "c": nil]
937
937
///
938
938
/// let c: [String: Int] = data.compactMapValues { str in Int(str) }
939
939
/// // ["a": 1]
@@ -1183,7 +1183,7 @@ extension Dictionary {
1183
1183
/// If the key isn't found in the dictionary, `removeValue(forKey:)` returns
1184
1184
/// `nil`.
1185
1185
///
1186
- /// if let value = hues.removeValueForKey( "Cerise") {
1186
+ /// if let value = hues.removeValue(forKey: "Cerise") {
1187
1187
/// print("The value \(value) was removed.")
1188
1188
/// } else {
1189
1189
/// print("No value found for that key.")
0 commit comments