StandaloneDelegate

Swift

open class StandaloneDelegate<DelegateType> : NSObject where DelegateType : NSObjectProtocol

Base class that helps to build standalone delegate handlers. Class will live as long as bound target lives. Automatically forwards non-implemented delegate overrides to the originalDelegate, if one is set.

class DocumentSharingDelegateHandler: StandaloneDelegate<PDFDocumentSharingViewControllerDelegate>, PDFDocumentSharingViewControllerDelegate {
    (your delegate implementations)
}

// The `StandaloneDelegateContainer` will automatically manage the lifetime of this helper.
// It will be deallocated as soon as sharingController is deallocated.
let handler = DocumentSharingHandler(delegateTarget: sharingController, originalDelegate: sharingController.delegate)
sharingController.delegate = handler