Review feedback
This commit is contained in:
@@ -17,7 +17,7 @@ protocol ServerMultiplexDelegate
|
||||
|
||||
enum ServerMultiplexError : Error
|
||||
{
|
||||
case UnknownDevice
|
||||
case unknownDevice
|
||||
}
|
||||
|
||||
class ServerMultiplex
|
||||
@@ -26,7 +26,7 @@ class ServerMultiplex
|
||||
public private(set) var devices = Set<AnyDevice>()
|
||||
|
||||
private var servers: [Server] = []
|
||||
public var numServers: Int { get { return servers.count } }
|
||||
public var numServers: Int { return servers.count }
|
||||
|
||||
public func addServer(_ server: Server)
|
||||
{
|
||||
@@ -48,7 +48,7 @@ class ServerMultiplex
|
||||
devices[index].state = state
|
||||
}
|
||||
} else {
|
||||
completion(ServerMultiplexError.UnknownDevice)
|
||||
completion(ServerMultiplexError.unknownDevice)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,17 +76,15 @@ class WemoServer : Server
|
||||
func fetchDevices(_ completion: @escaping (Result<[AnyDevice], Error>) -> Void)
|
||||
{
|
||||
let op = FetchDevicesOperation(baseURL: self.baseURL, session: _urlSession)
|
||||
weak var weakOp = op
|
||||
op.completionBlock = {
|
||||
guard let strongOp = weakOp else { return }
|
||||
if let error = strongOp.error {
|
||||
op.completionBlock = { [unowned op] in
|
||||
if let error = op.error {
|
||||
self._logError("Error fetching devices", error: error)
|
||||
completion(.failure(error))
|
||||
} else {
|
||||
self.devices = strongOp.devices
|
||||
self.devices = op.devices
|
||||
}
|
||||
|
||||
self.devices = strongOp.devices
|
||||
self.devices = op.devices
|
||||
completion(.success(self.devices.map { AnyDevice($0) }))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user