Skip to content

Commit bc83377

Browse files
Add extension to ScopedDisposable for SerialDisposable (#873)
* Add extension to ScopedDisposable for SerialDisposable * Fix user name --------- Co-authored-by: Michael Brown <[email protected]>
1 parent 6e23f11 commit bc83377

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
1. Fix minimum deployment target of iOS 11 in CocoaPods
55
1. Fix CI release git tag push trigger (#869, kudos to @p4checo)
66
1. Find and remove items from Bag using a binary search to improve performance when the collection gets large.
7+
2. Add extension to `ScopedDisposable` for inner `SerialDisposable` (#873, kudos to @sirnacnud)
78

89
# 7.1.1
910
1. Bumped deployment target to iOS 11, tvOS 11, watchOS 4, macOS 10.13, per Xcode 14 warnings (#865, kudos to @lickel)

Sources/Disposable.swift

+16
Original file line numberDiff line numberDiff line change
@@ -378,3 +378,19 @@ public final class SerialDisposable: Disposable {
378378
state.deinitialize()
379379
}
380380
}
381+
382+
extension ScopedDisposable where Inner == SerialDisposable {
383+
/// The current inner disposable of the `SerialDisposable` wrapped
384+
/// in the `ScopedDisposable` to dispose of.
385+
///
386+
/// Whenever this property is set (even to the same value!), the previous
387+
/// disposable is automatically disposed.
388+
public var inner: Disposable? {
389+
get {
390+
return inner.inner
391+
}
392+
set {
393+
inner.inner = newValue
394+
}
395+
}
396+
}

0 commit comments

Comments
 (0)