Skip to content

Instantly share code, notes, and snippets.

View saagarjha's full-sized avatar

Saagar Jha saagarjha

View GitHub Profile
//
// Logic necessary to implement a "closing handler" for a NSDocument
//
// This is inspired by:
// - https://stackoverflow.com/questions/49343307/best-practice-to-implement-canclosewithdelegateshouldclosecontextinfo
// - https://github.com/keith/radars/blob/master/NSDocumentSwiftAnnotations/NSDocumentSwiftAnnotations/Document.swift
// Keith's supporting documentation for his radar submission: http://www.openradar.me/33422662
// Documentation:
// - https://developer.apple.com/library/content/releasenotes/AppKit/RN-AppKitOlderNotes/
// Paragraph called: "Advice for Overriders of Methods that Follow the delegate:didSomethingSelector:contextInfo: Pattern"