Skip to content

Instantly share code, notes, and snippets.

@josephlord
Created June 10, 2019 23:11
Show Gist options
  • Save josephlord/02175a2923144cee8be2f41bcad685de to your computer and use it in GitHub Desktop.
Save josephlord/02175a2923144cee8be2f41bcad685de to your computer and use it in GitHub Desktop.
Snippet of start of Core Data class (NSManagedObject subclass) with enough code to make it into a Bindable object
public class ListContent : NSManagedObject, BindableObject {
public let didChange = PassthroughSubject<Void, Never>()
private var changePublisher: PassthroughSubject<Void, Never> {
return didChange
}
override public func didChangeValue(forKey key: String) {
super.didChangeValue(forKey: key)
self.changePublisher.send(())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment