Store UIImage in CoreData Without Writing Any Code

There is an easy but little known way to store many kinds of UIKit objects in CoreData without writing any code. It works for UIImage, UIColor, UIBezierPath, MKPlaceMark, NSDate, and any other class that conforms to the NSCoding protocol.

What you need to do is set the attribute type to Transformable.

That’s it!

Now can set UIImage objects directly into your NSManagedObject objects:

2 thoughts on “Store UIImage in CoreData Without Writing Any Code

  1. Hi,

    I tried this with MKPlacemark and couldn’t get it to work as described above. However if I leave out the name field then it works. Apparently this is the default value anyway. This blog post was very useful, thanks.


  2. Wow this is really helpful. I am wondering….I also noticed another option box to “Store in External Record File”
    Anyone have experience with this? It may be the solution to Not storing images in the Core data. without a lot of coding.

Leave a Reply