Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor swiftlint warnings addressed #830

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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