We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 68ce623 commit f37bd60Copy full SHA for f37bd60
Foundation/NSURLSession/Configuration.swift
@@ -130,9 +130,17 @@ private func convertToStringString(dictionary: [AnyHashable:Any]) -> [String: St
130
// C.f. <https://github.com/apple/swift-corelibs-foundation/pull/287>
131
var r: [String: String] = [:]
132
dictionary.forEach {
133
- let k = String(describing: $0.key as! NSString)
134
- let v = String(describing: $0.value as! NSString)
+ let k = getString(from: $0.key)
+ let v = getString(from: $0.value)
135
r[k] = v
136
}
137
return r
138
139
+
140
+private func getString(from obj: Any) -> String {
141
+ if let string = obj as? String {
142
+ return string
143
+ } else {
144
+ return String(describing: obj as! NSString)
145
+ }
146
+}
0 commit comments