Skip to content

Commit

Permalink
Merge branch 'main' into deployment-target-macOS-15
Browse files Browse the repository at this point in the history
  • Loading branch information
F1248 committed Aug 23, 2024
2 parents 8968bc7 + 338e316 commit 9ebf729
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions Genius/Extensions/Foundation/Pipe.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Foundation
extension Pipe {

func read() -> String? {
guard let data = try? fileHandleForReading.readToEnd() else { return nil }
return String(data)
String(try? fileHandleForReading.readToEnd())
}
}
3 changes: 1 addition & 2 deletions Genius/Extensions/Foundation/URL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import Foundation
extension URL {

init?(_ path: String?) {
guard let path else { return nil }
guard FileManager.default.fileExists(atPath: path) else { return nil }
guard let path, FileManager.default.fileExists(atPath: path) else { return nil }
self.init(fileURLWithPath: path)
}
}
3 changes: 2 additions & 1 deletion Genius/Extensions/Swift/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ extension String {
).localized
}

init(_ data: Data) {
init?(_ data: Data?) {
guard let data else { return nil }
self.init(decoding: data, as: UTF8.self)
}

Expand Down
3 changes: 1 addition & 2 deletions Genius/Types/VersionNumber.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ struct VersionNumber {
init?(_ versionNumber: Any?) {
guard let versionNumber = versionNumber as? Substring else { return nil }
let components = versionNumber.split(separator: ".")
guard !components.isEmpty else { return nil }
guard let versions = [Int](components) else { return nil }
guard !components.isEmpty, let versions = [Int](components) else { return nil }
self.versions = versions
}
}

0 comments on commit 9ebf729

Please sign in to comment.