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.

Example Usage: class DocumentSharingDelegateHandler: StandaloneDelegate, 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