Skip to content

Commit

Permalink
Use String(data:encoding:) instead of NSString(data:encoding:)
Browse files Browse the repository at this point in the history
  • Loading branch information
devxoul committed Nov 2, 2016
1 parent 0fe1ae3 commit aefaaf9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Source/Plugins/NetworkLoggerPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private extension NetworkLoggerPlugin {
}

if let body = request?.httpBody, verbose == true {
if let stringOutput = NSString(data: body, encoding: String.Encoding.utf8.rawValue) as? String {
if let stringOutput = String(data: body, encoding: .utf8) {
output += [format(loggerId, date: date, identifier: "Request Body", message: stringOutput)]
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public extension Response {

/// Maps data received from the signal into a String.
func mapString() throws -> String {
guard let string = NSString(data: data, encoding: String.Encoding.utf8.rawValue) else {
guard let string = String(data: data, encoding: .utf8) else {
throw Error.stringMapping(self)
}
return string as String
return string
}
}

0 comments on commit aefaaf9

Please sign in to comment.