Skip to content

Commit ef4e68f

Browse files
committed
Move Unnecessary NSAttributedString Extension
1 parent 1090c23 commit ef4e68f

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

Example/CodeEditTextViewExample/CodeEditTextViewExample/Documents/CodeEditTextViewExampleDocument.swift

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,13 @@ struct CodeEditTextViewExampleDocument: FileDocument, @unchecked Sendable {
3333
}
3434

3535
func fileWrapper(configuration: WriteConfiguration) throws -> FileWrapper {
36-
let data = try text.data(for: NSRange(location: 0, length: text.length))
37-
return .init(regularFileWithContents: data)
38-
}
39-
}
40-
41-
extension NSAttributedString {
42-
func data(for range: NSRange) throws -> Data {
43-
try data(
44-
from: range,
36+
let data = try text.data(
37+
from: NSRange(location: 0, length: text.length),
4538
documentAttributes: [
4639
.documentType: NSAttributedString.DocumentType.plain,
4740
.characterEncoding: NSUTF8StringEncoding
4841
]
4942
)
43+
return .init(regularFileWithContents: data)
5044
}
5145
}

0 commit comments

Comments
 (0)