Skip to content

Commit 32f2d96

Browse files
committed
Replace string init.
1 parent d2922ae commit 32f2d96

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Shared/Samples/Animate 3D graphic/Animate3DGraphicView.Model.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,9 @@ extension Animate3DGraphicView {
276276
/// Loads the frames of a mission from a CSV file.
277277
/// - Parameter filename: The name of the file containing the CSV data.
278278
mutating func loadFrames(for filename: String) {
279-
// Get the path of the file from the bundle using the filename name.
280-
guard let path = Bundle.main.path(forResource: filename, ofType: "csv") else { return }
281-
282-
// Get the content of the file using the path.
283-
guard let content = try? String(contentsOfFile: path) else { return }
279+
// Get the content of the file from the bundle using the filename name.
280+
guard let path = Bundle.main.url(forResource: filename, withExtension: "csv"),
281+
let content = try? String(contentsOf: path, encoding: .utf8) else { return }
284282

285283
// Split the content by line into an array.
286284
let lines = content.split(whereSeparator: \.isNewline)

0 commit comments

Comments
 (0)