if you use an attribute of type transformable you can set a correspoding custom class which describes the type of the saved value. In the .xcdatamodeld this is pretty easily accomplished as you can see in the picture. if you use an attribute of type transformable y