Found a better way to enforce that objects saved to keychain implement NSCoding: just declare that as the type required and returned. Now only objects that implement NSCoding can be used, else a compile time error will be generated.