Skip to content

Commit 0fcd3e5

Browse files
committed
Updated inline docs
1 parent 34e4177 commit 0fcd3e5

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Sources/TextFile/PlainTextFile/PlainTextFile.swift

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public struct PlainTextFile {
1818
public internal(set) var encoding: String.Encoding
1919

2020
/// The file URL, if the text file was read from disk.
21-
/// If the file was read from memory (`Data`), this property may be `nil`.
21+
/// If the file was read from memory (`Data`), this property will be `nil`.
2222
public internal(set) var url: URL?
2323

2424
/// Initialize by directly populating properties.
@@ -78,6 +78,12 @@ extension PlainTextFile {
7878

7979
extension PlainTextFile {
8080
/// Attempt to decode raw text file contents.
81+
///
82+
/// - Parameters:
83+
/// - data: Raw (encoded) text file content.
84+
/// - encoding: Optionally supply a text encoding if it is known.
85+
/// If decoding fails or this parameter is `nil`, a hybrid auto-detection strategy will be used to attempt
86+
/// to auto-detect the text encoding.
8187
public init(
8288
data: Data,
8389
preferring encoding: String.Encoding? = nil
@@ -95,6 +101,14 @@ extension PlainTextFile {
95101
}
96102

97103
/// Attempt to decode raw text file contents.
104+
///
105+
/// - Parameters:
106+
/// - data: Raw (encoded) text file content.
107+
/// - strategy: Text encoding auto-detection heuristic (strategy). Hyrbid (default) is recommended and will
108+
/// produce the best results.
109+
/// - encoding: Optionally supply a text encoding if it is known.
110+
/// If decoding fails or this parameter is `nil`, the auto-detection strategy will be used to attempt to
111+
/// auto-detect the text encoding.
98112
public init(
99113
data: Data,
100114
strategy: some TextFileDecodingStrategy,

0 commit comments

Comments
 (0)