Browse Source

Updated all public docstrings to latest Swift 2.0 syntax.

Christian Noon 10 years ago
parent
commit
4aae4134dc

+ 27 - 27
Source/MultipartFormData.swift

@@ -117,7 +117,7 @@ public class MultipartFormData {
     /**
     /**
         Creates a multipart form data object.
         Creates a multipart form data object.
 
 
-        :returns: The multipart form data object.
+        - returns: The multipart form data object.
     */
     */
     public init() {
     public init() {
         self.boundary = BoundaryGenerator.randomBoundary()
         self.boundary = BoundaryGenerator.randomBoundary()
@@ -143,8 +143,8 @@ public class MultipartFormData {
         - Encoded data
         - Encoded data
         - Multipart form boundary
         - Multipart form boundary
 
 
-        :param: data The data to encode into the multipart form data.
-        :param: name The name to associate with the data in the `Content-Disposition` HTTP header.
+        - parameter data: The data to encode into the multipart form data.
+        - parameter name: The name to associate with the data in the `Content-Disposition` HTTP header.
     */
     */
     public func appendBodyPart(data data: NSData, name: String) {
     public func appendBodyPart(data data: NSData, name: String) {
         let headers = contentHeaders(name: name)
         let headers = contentHeaders(name: name)
@@ -164,9 +164,9 @@ public class MultipartFormData {
         - Encoded data
         - Encoded data
         - Multipart form boundary
         - Multipart form boundary
 
 
-        :param: data The data to encode into the multipart form data.
-        :param: name The name to associate with the data in the `Content-Disposition` HTTP header.
-        :param: mimeType The MIME type to associate with the data content type in the `Content-Type` HTTP header.
+        - parameter data: The data to encode into the multipart form data.
+        - parameter name: The name to associate with the data in the `Content-Disposition` HTTP header.
+        - parameter mimeType: The MIME type to associate with the data content type in the `Content-Type` HTTP header.
     */
     */
     public func appendBodyPart(data data: NSData, name: String, mimeType: String) {
     public func appendBodyPart(data data: NSData, name: String, mimeType: String) {
         let headers = contentHeaders(name: name, mimeType: mimeType)
         let headers = contentHeaders(name: name, mimeType: mimeType)
@@ -186,10 +186,10 @@ public class MultipartFormData {
         - Encoded file data
         - Encoded file data
         - Multipart form boundary
         - Multipart form boundary
 
 
-        :param: data     The data to encode into the multipart form data.
-        :param: name     The name to associate with the data in the `Content-Disposition` HTTP header.
-        :param: fileName The filename to associate with the data in the `Content-Disposition` HTTP header.
-        :param: mimeType The MIME type to associate with the data in the `Content-Type` HTTP header.
+        - parameter data:     The data to encode into the multipart form data.
+        - parameter name:     The name to associate with the data in the `Content-Disposition` HTTP header.
+        - parameter fileName: The filename to associate with the data in the `Content-Disposition` HTTP header.
+        - parameter mimeType: The MIME type to associate with the data in the `Content-Type` HTTP header.
     */
     */
     public func appendBodyPart(data data: NSData, name: String, fileName: String, mimeType: String) {
     public func appendBodyPart(data data: NSData, name: String, fileName: String, mimeType: String) {
         let headers = contentHeaders(name: name, fileName: fileName, mimeType: mimeType)
         let headers = contentHeaders(name: name, fileName: fileName, mimeType: mimeType)
@@ -213,8 +213,8 @@ public class MultipartFormData {
         `fileURL`. The `Content-Type` HTTP header MIME type is generated by mapping the `fileURL` extension to the
         `fileURL`. The `Content-Type` HTTP header MIME type is generated by mapping the `fileURL` extension to the
         system associated MIME type.
         system associated MIME type.
 
 
-        :param: fileURL The URL of the file whose content will be encoded into the multipart form data.
-        :param: name    The name to associate with the file content in the `Content-Disposition` HTTP header.
+        - parameter fileURL: The URL of the file whose content will be encoded into the multipart form data.
+        - parameter name:    The name to associate with the file content in the `Content-Disposition` HTTP header.
     */
     */
     public func appendBodyPart(fileURL fileURL: NSURL, name: String) {
     public func appendBodyPart(fileURL fileURL: NSURL, name: String) {
         if let
         if let
@@ -242,10 +242,10 @@ public class MultipartFormData {
         - Encoded file data
         - Encoded file data
         - Multipart form boundary
         - Multipart form boundary
 
 
-        :param: fileURL  The URL of the file whose content will be encoded into the multipart form data.
-        :param: name     The name to associate with the file content in the `Content-Disposition` HTTP header.
-        :param: fileName The filename to associate with the file content in the `Content-Disposition` HTTP header.
-        :param: mimeType The MIME type to associate with the file content in the `Content-Type` HTTP header.
+        - parameter fileURL:  The URL of the file whose content will be encoded into the multipart form data.
+        - parameter name:     The name to associate with the file content in the `Content-Disposition` HTTP header.
+        - parameter fileName: The filename to associate with the file content in the `Content-Disposition` HTTP header.
+        - parameter mimeType: The MIME type to associate with the file content in the `Content-Type` HTTP header.
     */
     */
     public func appendBodyPart(fileURL fileURL: NSURL, name: String, fileName: String, mimeType: String) {
     public func appendBodyPart(fileURL fileURL: NSURL, name: String, fileName: String, mimeType: String) {
         let headers = contentHeaders(name: name, fileName: fileName, mimeType: mimeType)
         let headers = contentHeaders(name: name, fileName: fileName, mimeType: mimeType)
@@ -344,11 +344,11 @@ public class MultipartFormData {
         - Encoded stream data
         - Encoded stream data
         - Multipart form boundary
         - Multipart form boundary
 
 
-        :param: stream   The input stream to encode in the multipart form data.
-        :param: length   The content length of the stream.
-        :param: name     The name to associate with the stream content in the `Content-Disposition` HTTP header.
-        :param: fileName The filename to associate with the stream content in the `Content-Disposition` HTTP header.
-        :param: mimeType The MIME type to associate with the stream content in the `Content-Type` HTTP header.
+        - parameter stream:   The input stream to encode in the multipart form data.
+        - parameter length:   The content length of the stream.
+        - parameter name:     The name to associate with the stream content in the `Content-Disposition` HTTP header.
+        - parameter fileName: The filename to associate with the stream content in the `Content-Disposition` HTTP header.
+        - parameter mimeType: The MIME type to associate with the stream content in the `Content-Type` HTTP header.
     */
     */
     public func appendBodyPart(stream stream: NSInputStream, length: UInt64, name: String, fileName: String, mimeType: String) {
     public func appendBodyPart(stream stream: NSInputStream, length: UInt64, name: String, fileName: String, mimeType: String) {
         let headers = contentHeaders(name: name, fileName: fileName, mimeType: mimeType)
         let headers = contentHeaders(name: name, fileName: fileName, mimeType: mimeType)
@@ -364,9 +364,9 @@ public class MultipartFormData {
         - Encoded stream data
         - Encoded stream data
         - Multipart form boundary
         - Multipart form boundary
 
 
-        :param: stream  The input stream to encode in the multipart form data.
-        :param: length  The content length of the stream.
-        :param: headers The HTTP headers for the body part.
+        - parameter stream:  The input stream to encode in the multipart form data.
+        - parameter length:  The content length of the stream.
+        - parameter headers: The HTTP headers for the body part.
     */
     */
     public func appendBodyPart(stream stream: NSInputStream, length: UInt64, headers: [String: String]) {
     public func appendBodyPart(stream stream: NSInputStream, length: UInt64, headers: [String: String]) {
         let bodyPart = BodyPart(headers: headers, bodyStream: stream, bodyContentLength: length)
         let bodyPart = BodyPart(headers: headers, bodyStream: stream, bodyContentLength: length)
@@ -382,7 +382,7 @@ public class MultipartFormData {
         time. This method should only be used when the encoded data will have a small memory footprint. For large data 
         time. This method should only be used when the encoded data will have a small memory footprint. For large data 
         cases, please use the `writeEncodedDataToDisk(fileURL:completionHandler:)` method.
         cases, please use the `writeEncodedDataToDisk(fileURL:completionHandler:)` method.
 
 
-        :returns: EncodingResult containing an `NSData` object if the encoding succeeded, an `NSError` otherwise.
+        - returns: EncodingResult containing an `NSData` object if the encoding succeeded, an `NSError` otherwise.
     */
     */
     public func encode() -> EncodingResult {
     public func encode() -> EncodingResult {
         if let bodyPartError = bodyPartError {
         if let bodyPartError = bodyPartError {
@@ -415,8 +415,8 @@ public class MultipartFormData {
         This process is facilitated by reading and writing with input and output streams, respectively. Thus,
         This process is facilitated by reading and writing with input and output streams, respectively. Thus,
         this approach is very memory efficient and should be used for large body part data.
         this approach is very memory efficient and should be used for large body part data.
 
 
-        :param: fileURL           The file URL to write the multipart form data into.
-        :param: completionHandler A closure to be executed when writing is finished.
+        - parameter fileURL:           The file URL to write the multipart form data into.
+        - parameter completionHandler: A closure to be executed when writing is finished.
     */
     */
     public func writeEncodedDataToDisk(fileURL: NSURL, completionHandler: (NSError?) -> Void) {
     public func writeEncodedDataToDisk(fileURL: NSURL, completionHandler: (NSError?) -> Void) {
         if let bodyPartError = bodyPartError {
         if let bodyPartError = bodyPartError {

+ 2 - 2
Source/Request.swift

@@ -123,9 +123,9 @@ public class Request {
 
 
         This closure returns the bytes most recently received from the server, not including data from previous calls. If this closure is set, data will only be available within this closure, and will not be saved elsewhere. It is also important to note that the `response` closure will be called with nil `responseData`.
         This closure returns the bytes most recently received from the server, not including data from previous calls. If this closure is set, data will only be available within this closure, and will not be saved elsewhere. It is also important to note that the `response` closure will be called with nil `responseData`.
 
 
-        :param: closure The code to be executed periodically during the lifecycle of the request.
+        - parameter closure: The code to be executed periodically during the lifecycle of the request.
 
 
-        :returns: The request.
+        - returns: The request.
     */
     */
     public func stream(closure: (NSData -> Void)? = nil) -> Self {
     public func stream(closure: (NSData -> Void)? = nil) -> Self {
         if let dataDelegate = delegate as? DataTaskDelegate {
         if let dataDelegate = delegate as? DataTaskDelegate {

+ 9 - 9
Source/ResponseSerialization.swift

@@ -48,9 +48,9 @@ public struct GenericResponseSerializer<T>: ResponseSerializer {
     /**
     /**
         Initializes the `GenericResponseSerializer` instance with the given serialize response closure.
         Initializes the `GenericResponseSerializer` instance with the given serialize response closure.
 
 
-        :param: serializeResponse The closure used to serialize the response.
+        - parameter serializeResponse: The closure used to serialize the response.
 
 
-        :returns: The new generic response serializer instance.
+        - returns: The new generic response serializer instance.
     */
     */
     public init(serializeResponse: (NSURLRequest?, NSHTTPURLResponse?, NSData?) -> (SerializedObject?, NSError?)) {
     public init(serializeResponse: (NSURLRequest?, NSHTTPURLResponse?, NSData?) -> (SerializedObject?, NSError?)) {
         self.serializeResponse = serializeResponse
         self.serializeResponse = serializeResponse
@@ -64,11 +64,11 @@ extension Request {
     /**
     /**
         Adds a handler to be called once the request has finished.
         Adds a handler to be called once the request has finished.
 
 
-        :param: queue The queue on which the completion handler is dispatched.
-        :param: responseSerializer The response serializer responsible for serializing the request, response, and data.
-        :param: completionHandler The code to be executed once the request has finished.
+        - parameter queue: The queue on which the completion handler is dispatched.
+        - parameter responseSerializer: The response serializer responsible for serializing the request, response, and data.
+        - parameter completionHandler: The code to be executed once the request has finished.
 
 
-        :returns: The request.
+        - returns: The request.
     */
     */
     public func response<T: ResponseSerializer, V where T.SerializedObject == V>(
     public func response<T: ResponseSerializer, V where T.SerializedObject == V>(
         queue: dispatch_queue_t? = nil,
         queue: dispatch_queue_t? = nil,
@@ -98,7 +98,7 @@ extension Request {
     /**
     /**
         Creates a response serializer that returns the associated data as-is.
         Creates a response serializer that returns the associated data as-is.
 
 
-        :returns: A data response serializer.
+        - returns: A data response serializer.
     */
     */
     public static func dataResponseSerializer() -> GenericResponseSerializer<NSData> {
     public static func dataResponseSerializer() -> GenericResponseSerializer<NSData> {
         return GenericResponseSerializer { request, response, data in
         return GenericResponseSerializer { request, response, data in
@@ -109,9 +109,9 @@ extension Request {
     /**
     /**
         Adds a handler to be called once the request has finished.
         Adds a handler to be called once the request has finished.
 
 
-        :param: completionHandler The code to be executed once the request has finished.
+        - parameter completionHandler: The code to be executed once the request has finished.
 
 
-        :returns: The request.
+        - returns: The request.
     */
     */
     public func response(completionHandler: (NSURLRequest?, NSHTTPURLResponse?, NSData?, NSError?) -> Void) -> Self {
     public func response(completionHandler: (NSURLRequest?, NSHTTPURLResponse?, NSData?, NSError?) -> Void) -> Self {
         return response(responseSerializer: Request.dataResponseSerializer(), completionHandler: completionHandler)
         return response(responseSerializer: Request.dataResponseSerializer(), completionHandler: completionHandler)

+ 9 - 9
Source/ServerTrustPolicy.swift

@@ -34,9 +34,9 @@ public class ServerTrustPolicyManager {
         allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key 
         allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key 
         pinning for host3 and disabling evaluation for host4.
         pinning for host3 and disabling evaluation for host4.
 
 
-        :param: policies A dictionary of all policies mapped to a particular host.
+        - parameter policies: A dictionary of all policies mapped to a particular host.
 
 
-        :returns: The new `ServerTrustPolicyManager` instance.
+        - returns: The new `ServerTrustPolicyManager` instance.
     */
     */
     public init(policies: [String: ServerTrustPolicy]) {
     public init(policies: [String: ServerTrustPolicy]) {
         self.policies = policies
         self.policies = policies
@@ -110,9 +110,9 @@ public enum ServerTrustPolicy {
     /**
     /**
         Returns all certificates within the given bundle with a `.cer` file extension.
         Returns all certificates within the given bundle with a `.cer` file extension.
 
 
-        :param: bundle The bundle to search for all `.cer` files.
+        - parameter bundle: The bundle to search for all `.cer` files.
 
 
-        :returns: All certificates within the given bundle.
+        - returns: All certificates within the given bundle.
     */
     */
     public static func certificatesInBundle(bundle: NSBundle = NSBundle.mainBundle()) -> [SecCertificate] {
     public static func certificatesInBundle(bundle: NSBundle = NSBundle.mainBundle()) -> [SecCertificate] {
         var certificates: [SecCertificate] = []
         var certificates: [SecCertificate] = []
@@ -132,9 +132,9 @@ public enum ServerTrustPolicy {
     /**
     /**
         Returns all public keys within the given bundle with a `.cer` file extension.
         Returns all public keys within the given bundle with a `.cer` file extension.
 
 
-        :param: bundle The bundle to search for all `*.cer` files.
+        - parameter bundle: The bundle to search for all `*.cer` files.
 
 
-        :returns: All public keys within the given bundle.
+        - returns: All public keys within the given bundle.
     */
     */
     public static func publicKeysInBundle(bundle: NSBundle = NSBundle.mainBundle()) -> [SecKey] {
     public static func publicKeysInBundle(bundle: NSBundle = NSBundle.mainBundle()) -> [SecKey] {
         var publicKeys: [SecKey] = []
         var publicKeys: [SecKey] = []
@@ -153,10 +153,10 @@ public enum ServerTrustPolicy {
     /**
     /**
         Evaluates whether the server trust is valid for the given host.
         Evaluates whether the server trust is valid for the given host.
 
 
-        :param: serverTrust The server trust to evaluate.
-        :param: host        The host of the challenge protection space.
+        - parameter serverTrust: The server trust to evaluate.
+        - parameter host:        The host of the challenge protection space.
 
 
-        :returns: Whether the server trust is valid.
+        - returns: Whether the server trust is valid.
     */
     */
     public func evaluateServerTrust(serverTrust: SecTrust, isValidForHost host: String) -> Bool {
     public func evaluateServerTrust(serverTrust: SecTrust, isValidForHost host: String) -> Bool {
         var serverTrustIsValid = false
         var serverTrustIsValid = false