We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bfc748a commit fbc2144Copy full SHA for fbc2144
1 file changed
Tool/Sources/XcodeInspector/SourceEditor.swift
@@ -129,13 +129,14 @@ public extension SourceEditor {
129
}
130
131
static func breakLines(_ string: String) -> [String] {
132
- let lines = string.split(whereSeparator: \.isNewline, omittingEmptySubsequences: false)
+ let lineEnding = string.first(where: \.isNewline) ?? "\n"
133
+ let lines = string.split(omittingEmptySubsequences: false, whereSeparator: \.isNewline)
134
var all = [String]()
135
for (index, line) in lines.enumerated() {
136
if index == lines.endIndex - 1 {
137
all.append(String(line))
138
} else {
- all.append(String(line) + "\n")
139
+ all.append(String(line) + String(lineEnding))
140
141
142
return all
0 commit comments