Skip to content

Commit

Permalink
feat: update documentation
Browse files Browse the repository at this point in the history
Resolves: none.
  • Loading branch information
loay-ashraf committed Oct 1, 2024
1 parent 0b5ac1a commit 5fab681
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Source/HTTP/Extensions/Data+Append.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@

import Foundation

/// An extension to the `Data` class that provides additional functionalities
/// for appending multiple `Data` objects to an existing `Data` instance.
extension Data {

/// Appends the contents of an array of `Data` objects to the current `Data` instance.
///
/// This method iterates through the provided array and appends each `Data` object
/// to the receiver.
///
/// - Parameter data: An array of `Data` objects to append to the current instance.
mutating func append(contentsOf data: [Data]) {
data.forEach({ self.append($0) })
}

}

10 changes: 10 additions & 0 deletions Source/HTTP/Extensions/String+InputStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@

import Foundation

/// An extension to the `String` class providing additional functionalities,
/// specifically for converting a string into an `InputStream`.
extension String {

/// Converts the string into an `InputStream`.
///
/// This property creates an `InputStream` from the string's UTF-8 encoded data.
/// If the conversion fails, it returns `nil`.
///
/// - Returns: An optional `InputStream` created from the string's data.
var inputStream: InputStream? {
guard let data = self.data(using: .utf8) else { return nil }
return .init(data: data)
}

}

0 comments on commit 5fab681

Please sign in to comment.