Back to Rxswift

SingleAssignmentDisposable

docs/Classes/SingleAssignmentDisposable.html

6.10.21.2 KB
Original Source

SingleAssignmentDisposable

public final class SingleAssignmentDisposable : DisposeBase, Cancelable

Represents a disposable resource which only allows a single assignment of its underlying disposable resource.

If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an exception.

`

                isDisposed
                `

Declaration

Swift

public var isDisposed: Bool { get }

Return Value

A value that indicates whether the object is disposed.

`

                init()
                `

Initializes a new instance of the SingleAssignmentDisposable.

Declaration

Swift

override public init()

`

                setDisposable(_:)
                `

Gets or sets the underlying disposable. After disposal, the result of getting this property is undefined.

Throws exception if the SingleAssignmentDisposable has already been assigned to.

Declaration

Swift

public func setDisposable(_ disposable: Disposable)

`

                dispose()
                `

Disposes the underlying disposable.

Declaration

Swift

public func dispose()