This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See how to use it at the bottom of this file | |
// Helper struct for sequenceDiff | |
public struct SequenceDiff<T1, T2> { | |
public let common: [(T1, T2)] | |
public let removed: [T1] | |
public let inserted: [T2] | |
public init(common: [(T1, T2)] = [], removed: [T1] = [], inserted: [T2] = []) { | |
self.common = common | |
self.removed = removed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Figuring out how CoreStore's monitor/observer mechanism works was a painful | |
// experience. This is a working example of how to use list object observers and | |
// single object observers. You'll need CoreStore, of course, to run this. | |
// Instantiate a Database object and call the .go() method. The reason for the | |
// Timers is that I wanted to make sure the code would run in asynchronous pieces, | |
// rather than all on one execution thread, to more-or-less simulate mouse | |
// clicks in a real app. | |
// | |
// https://github.com/JohnEstropia/CoreStore -- don't get me wrong, it was | |
// worth the pain. But with any luck this example will spare you some headaches. |
NewerOlder