Skip to content

Commit 7b38295

Browse files
committed
'Cancel' for PromiseKit -- add cancellable wrappers for the HomeKit extensions
1 parent 2d50739 commit 7b38295

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "dougzilla32/PromiseKit" "ca04ff47d07b79edf9b1fc53be49e6c9d4148601"
1+
github "dougzilla32/PromiseKit" "e87ade8ea8910a04a2286e34ed5e52163176738c"

Sources/HMAcessoryBrowser+Promise.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,11 @@ private class BrowserProxy: PromiseProxy<[HMAccessory]>, HMAccessoryBrowserDeleg
7676
}
7777

7878
#endif
79+
80+
//////////////////////////////////////////////////////////// Cancellable wrapper
81+
82+
extension HMPromiseAccessoryBrowser {
83+
public func cancellableStart(scanInterval: ScanInterval) -> CancellablePromise<[HMAccessory]> {
84+
return cancellable(start(scanInterval: scanInterval))
85+
}
86+
}

Sources/HMHomeManager+Promise.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,12 @@ internal class HMHomeManagerProxy: PromiseProxy<[HMHome]>, HMHomeManagerDelegate
6565
super.cancel()
6666
}
6767
}
68+
69+
//////////////////////////////////////////////////////////// Cancellable wrapper
70+
71+
@available(iOS 8.0, tvOS 10.0, *)
72+
extension HMHomeManager {
73+
public func cancellableHomes() -> CancellablePromise<[HMHome]> {
74+
return cancellable(homes())
75+
}
76+
}

0 commit comments

Comments
 (0)