Skip to content

Commit

Permalink
Minor swiftlint warnings addressed (#830)
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Bert <[email protected]>
Co-authored-by: Dan Cunningham <[email protected]>
  • Loading branch information
timbms and digitaldan authored Sep 18, 2024
1 parent e0069b4 commit 6754e0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions OpenHABCore/Sources/OpenHABCore/Util/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ public struct UserDefault<T> {
}
}

public var projectedValue: AnyPublisher<T, Never> {
subject.eraseToAnyPublisher()
}

public init(_ key: String, defaultValue: T) {
self.key = key
self.defaultValue = defaultValue
let currentValue = Preferences.sharedDefaults.object(forKey: key) as? T ?? defaultValue
subject = CurrentValueSubject<T, Never>(currentValue)
}

public var projectedValue: AnyPublisher<T, Never> {
subject.eraseToAnyPublisher()
}
}

@propertyWrapper
Expand Down Expand Up @@ -73,17 +73,17 @@ public struct UserDefaultURL {
}
}

public var projectedValue: AnyPublisher<String, Never> {
subject.eraseToAnyPublisher()
}

public init(_ key: String, defaultValue: String) {
self.key = key
self.defaultValue = defaultValue
let currentValue = Preferences.sharedDefaults.string(forKey: key) ?? defaultValue
subject = CurrentValueSubject<String, Never>(currentValue)
}

public var projectedValue: AnyPublisher<String, Never> {
subject.eraseToAnyPublisher()
}

private func uriWithoutTrailingSlashes(_ hostUri: String) -> String {
if hostUri.hasSuffix("/") {
return String(hostUri[..<hostUri.index(before: hostUri.endIndex)])
Expand Down
4 changes: 2 additions & 2 deletions openHAB/OpenHABRootViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ class OpenHABRootViewController: UIViewController {
}
if let urlComponents = URLComponents(string: path) {
let queryItems = urlComponents.queryItems
let sitemap = queryItems?.first(where: { $0.name == "sitemap" })?.value
let subview = queryItems?.first(where: { $0.name == "w" })?.value
let sitemap = queryItems?.first { $0.name == "sitemap" }?.value
let subview = queryItems?.first { $0.name == "w" }?.value
if let sitemap {
sitemapViewController.pushSitemap(name: sitemap, path: subview)
}
Expand Down

0 comments on commit 6754e0c

Please sign in to comment.