You can confirm this in at least two places:
Write an app that accesses the photo library and launch it with these command line arguments:
-com.apple.CoreData.SQLDebug 1. As you access the photo library, you’ll see Core Data logging debug information to the Console.
Finding PhotoKit’s Core Data model
In my quest to understand the Photos framework better (especially its performance characteristics), I wanted to inspect its data model. I found a file named
PhotoLibraryServices.framework/photos.momd/photos-10.0.mom deep in the bowels of the Xcode 10.0 app bundle:1
Opening compiled Core Data models in Xcode
.mom file is a compiled Core Data model. Xcode can’t open this directly, but it can import one into another Core Data model. Follow these steps to view the model in Xcode:
- Create a new empty project. Xcode 10 doesn’t like to display Core Data model bundles outside of a project.
- Create a new empty “Core Data Data Model” file inside the project. This will create an
- Open the new data model and select Editor > Import…. Select the
.momfile you want to import.
Unfortunately, the compiled model doesn’t store the layout information for Xcode’s graphical model editor, so you’ll have to manually drag the entities into a pleasing layout. This took me a few hours.2
The formatted Photos model
photos-10.0.mom as bundled with Xcode 10.0 (iOS 12.0):
Not everything can be seen in this image. Download the full model and open it in Xcode to inspect attribute properties etc.
Note that this isn’t necessarily the entire data model for photos on iOS. There are more Core Data models in
PrivateFrameworks/PhotoAnalysis.framework which I ignored.
You can use this terminal command to find other Core Data models inside the simulator runtimes bundled with Xcode:
find /Applications/Xcode-10.app -name '*.mom'
Pro tip: you can use the arrow keys (and ⇧ + arrow keys) to position things precisely. Pro pro tip: don’t hit ⌘Z to undo a move operation. The graphical edits don’t register as undoable operations, so chances are Xcode will undo the initial import, which means you’ll lose all unsaved work. ↩︎