Skip to content

Instantly share code, notes, and snippets.

@johnsusek
Created March 6, 2020 01:33
Show Gist options
  • Save johnsusek/fab21d4629d1e2236c8927e507c53502 to your computer and use it in GitHub Desktop.
Save johnsusek/fab21d4629d1e2236c8927e507c53502 to your computer and use it in GitHub Desktop.
func outlineViewItemWillExpand(_ notification: Notification) {
if let entity = notification.userInfo?["NSObject"] as? DesktopFolderEntity {
guard let sortDescriptor = self.outlineView.sortDescriptors.first else { return }
entity.isExpanding = true
let childrenFetch = BlockOperation {
entity.buildChildren()
entity.sortChildren(sortDescriptor: sortDescriptor)
OperationQueue.main.addOperation {
entity.isExpanding = false
self.outlineView.reloadData()
}
}
self.childrenFetchQueue.addOperation(childrenFetch)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment