      
      - returns: The response.
      */
-    @warn_unused_result public func responseString(encoding encoding: NSStringEncoding? = nil) -> Response<String, NSError> {
+    public func responseString(encoding: String.Encoding? = nil) -> DataResponse<String> {
         
-        let semaphore = dispatch_semaphore_create(0)
+        let semaphore = DispatchSemaphore(value: 0)
         
-        var result: Response<String, NSError>!
-        
-        self.responseString(queue: dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), encoding: encoding, completionHandler: { response in
+        var result: DataResponse<String>!
+        self.responseString(queue: DispatchQueue.global(qos: .default), encoding: encoding){ response in
             
             result = response
-            dispatch_semaphore_signal(semaphore)
+            semaphore.signal()
             
-        })
+        }
         
-        dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER)
+        _ = semaphore.wait(timeout: DispatchTime.distantFuture)
         
         return result
     }

import Foundation
import Alamofire

extension Request {
    
    
    /**

     
     - returns: The response.
     */
    public func responseJSON(options: JSONSerialization.ReadingOptions = .allowFragments) -> DataResponse<Any> {
        
        let semaphore = DispatchSemaphore(value: 0)
        
        var result: DataResponse<Any>!
        
        self.responseJSON(queue: DispatchQueue.global(qos: .default), options: options) { response in
            
            result = response
            semaphore.signal()
            
        }
        
        _ = semaphore.wait(timeout: DispatchTime.distantFuture)
        
        return result
    }
