Working with NSPersisentCoordinator?

    lazy public var viewContext: NSManagedObjectContext = {

        let viewContext = self.persistentContainer.viewContext

        viewContext.automaticallyMergesChangesFromParent = true

        return viewContext



I suggest setting automaticallyMergesChangesFromParent so it can observe changes from the parent store. It’s also a good prereq for using the new newBackgroundContext() function because instead of spawning a child from the View Context, it spawns a private MOC directly from the persistent store (so no parent!).

It took me a good while to realize that!


Here’s an example:

let batchDeleteFetchRequest = NSFetchRequest(entityName: "Thing")
batchDeleteFetchRequest.sortDescriptors = [NSSortDescriptor(key: "uri", ascending: true)]
batchDeleteFetchRequest.predicate = NSPredicate(format: "NOT (uri IN %@)", URIsInDataDump)
let batchDeleteRequest = NSBatchDeleteRequest(fetchRequest: batchDeleteFetchRequest)
do {
    try managedObjectContext.executeRequest(batchDeleteRequest)
} catch {


There isn’t much official documentation out there because NSBatchDeleteRequest doesn’t exist in documentation, only a video clip from Core Data’s spotlight at WWDC.

Anyway, when running the above code and watching the context, you’ll notice no changes were acknowledged, though loading a new fetch does show the items were deleted. What?

Well, NSBatchDeleteRequest works by deleting directly from the store and even though it’s the managedObjectContext executing the request, it happens outside of its knowledge and therefore, isn’t aware of the persistent store change.

This can be fixed, though, by telling your Managed Object Contexts to automatically consume changes from parent.

A New Look & Feel That’s SEO Friendly

It’s not very often I get the time to sit down and completely redo my website, but for the first time in awhile I did just that thanks to a bit of inspiration. Just last week I had a meeting at work with our outsource SEO guy, Chris Westmeyer who gave us a few pointers worth sharing here about SEO, and a few things I took into consideration whenever I built this theme.

One of the things to keep in mind – all of your content should be broken into separate pages and if that requires duplicating your content, that’s ok, as long as it’s not spamBut what’s that mean?

Check out the front page of Contagious, which has different sections of content as you scroll down the page (About, Projects, Contact, etc). Did you know that those individual sections are actually full pages that are being indexed individually by Google? Check it out. Using the power of get_post();, I was able to pull the content from those pages, not only creating an SEO friendly sprawl, but also a nice clean WordPress backend.

Boom. Roasted.

:after and :before only apply to container elements

This is a fun fact for all of you CSS heads out there that I didn’t realize until this morning: The :before and :after pseudo elements only can be applied to containing elements, which makes sense, but hasn’t been something I’ve come across yet.

While the button tag, which is a container and can have elements slipped inside it, an input[type=button] cannot.

Check out this long Stack here for even more information

Hell Bell

I care just a little too much about how my menu bar and dock are organized on my Macs. Well… I care way too much. This morning I open my laptop and what do I see?

Screen Shot 2013-11-25 at 11.11.25 AM

Screen Shot 2013-11-25 at 11.11.36 AM

Screen Shot 2013-11-25 at 11.11.41 AM

What the hell is this bell, you ask? God damn Chrome. Not only does it throw a little icon up there, it’s a full fledged notification system. One to replace one which already exists and works very well… because, you know, Google can. But, if you’re like me, and don’t want clutter all over the place but really like Chrome otherwise, here’s a guide to hide that little guy (and no, it’s not in settings this time around):

  1. Type chrome://flags/ into your browser
  2. Search for Enable Rich Notifications
  3. Mark it as disable and restart Chrome.

And bam! You’re finished and ready to go without staring at a faded bell all day.