mirror of
https://github.com/ninxsoft/Mist.git
synced 2025-05-09 14:01:55 -04:00
Fix remaining SwiftLint warnings
This commit is contained in:
parent
bafffe5df1
commit
c91e662627
3 changed files with 14 additions and 4 deletions
|
@ -30,7 +30,12 @@ extension Sequence where Iterator.Element == [String: Any] {
|
|||
/// - Returns: A JSON string representation.
|
||||
func jsonString() throws -> String {
|
||||
let data: Data = try JSONSerialization.data(withJSONObject: self, options: [.prettyPrinted, .sortedKeys])
|
||||
return String(decoding: data, as: UTF8.self)
|
||||
|
||||
guard let string: String = String(data: data, encoding: .utf8) else {
|
||||
throw MistError.invalidData
|
||||
}
|
||||
|
||||
return string
|
||||
}
|
||||
|
||||
/// Provides a Property List string representation.
|
||||
|
@ -40,7 +45,12 @@ extension Sequence where Iterator.Element == [String: Any] {
|
|||
/// - Returns: A Property List string representation.
|
||||
func propertyListString() throws -> String {
|
||||
let data: Data = try PropertyListSerialization.data(fromPropertyList: self, format: .xml, options: .bitWidth)
|
||||
return String(decoding: data, as: UTF8.self)
|
||||
|
||||
guard let string: String = String(data: data, encoding: .utf8) else {
|
||||
throw MistError.invalidData
|
||||
}
|
||||
|
||||
return string
|
||||
}
|
||||
|
||||
/// Provides a YAML string representation.
|
||||
|
|
|
@ -178,7 +178,7 @@ struct ActivityView: View {
|
|||
}
|
||||
|
||||
private func checkForUserCancellation(_ failure: Error) -> Bool {
|
||||
if failure as? CancellationError != nil {
|
||||
if failure is CancellationError {
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ struct RefreshView: View {
|
|||
var value: [String: Any] = value as? [String: Any],
|
||||
let date: Date = value["PostDate"] as? Date,
|
||||
let extendedMetaInfo: [String: Any] = value["ExtendedMetaInfo"] as? [String: Any],
|
||||
extendedMetaInfo["InstallAssistantPackageIdentifiers"] as? [String: Any] != nil,
|
||||
extendedMetaInfo["InstallAssistantPackageIdentifiers"] is [String: Any],
|
||||
let distributions: [String: Any] = value["Distributions"] as? [String: Any],
|
||||
let distributionURL: String = distributions["English"] as? String,
|
||||
let url: URL = URL(string: distributionURL) else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue