Skip to content

Commit

Permalink
isNil should be private
Browse files Browse the repository at this point in the history
  • Loading branch information
lhoward committed Jul 27, 2023
1 parent 31944d5 commit 518b2d4
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions Sources/SwiftOCADevice/OCC/PropertyTypes/DeviceProperty.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,6 @@ protocol OcaDevicePropertyRepresentable {
func set(object: OcaRoot, command: Ocp1Command) async throws
}

extension OcaDevicePropertyRepresentable {
public func isNil<Value: Codable>(_ value: Value) -> Bool {
if let value = value as? ExpressibleByNilLiteral,
let value = value as? Value?,
case .none = value
{
return true
} else {
return false
}
}
}

@propertyWrapper
public struct OcaDeviceProperty<Value: Codable>: OcaDevicePropertyRepresentable {
private var _storage: AsyncCurrentValueSubject<Value>
Expand Down Expand Up @@ -101,6 +88,17 @@ public struct OcaDeviceProperty<Value: Codable>: OcaDevicePropertyRepresentable
_storage.send(newValue)
}

private func isNil<Value: Codable>(_ value: Value) -> Bool {
if let value = value as? ExpressibleByNilLiteral,
let value = value as? Value?,
case .none = value
{
return true
} else {
return false
}
}

func get(object: OcaRoot) async throws -> Ocp1Response {
let value: Value = get(object: object)
if isNil(value) {
Expand Down

0 comments on commit 518b2d4

Please sign in to comment.