Skip to content

Instantly share code, notes, and snippets.

@mkral
mkral / gist:4696421
Last active December 12, 2015 02:08
My Resume
@pronebird
pronebird / MagicalRecord+Seam.m
Created December 23, 2015 13:41
MagicalRecord + Seam bridge
//
// MagicalRecord + Seam bridge
//
#import "MagicalRecord+SeamStore.h"
@import Seam;
@implementation NSPersistentStoreCoordinator (SeamStore)
@nicklockwood
nicklockwood / CodableVersioning.swift
Last active January 29, 2024 11:31
Example demonstrating how to use versioning for Codable structs
// This gist demonstrates how you can implement versioning for a Codable struct to support loading
// old serialized data after changing the structure. Notable features of this solution:
//
// * No need to make new properties optional, or to perform post-processing on the struct after
// loading in ordeer to populate missing values
// * No need to change the call site - from the outside this struct behaves just the same
// as if we had implemented codable directly in the normal way.
// * Versioning can be applied individually to parents or leaves in a larger tree of
// structs without affecting the other elements
// * This approach will work even if the original struct was not designed with versioning in mind