Search code examples
iosautomationios-simulator

How to automate creating Photo Albums on iOS (Simulator and/or Device)


I have a performance issue with some of my code, when the user has a large number of Albums in the Photos app it can slow down my custom photo picker code.

Creating Albums by hand is time-consuming so I've been looking into ways of automating the creation.

$ xcrun simctl addmedia booted ./TestPhoto001.jpg

The code above will add an image, but I can't find a way of adding it to an album, or create a new album.

Any and all suggestion will be greatly appreciated.


Solution

  • While researching solutions to this question, my colleague discovered some sample Apple code that can be used to generate Photos.

    We updated this code for Swift 5 and added the ability to create Albums.

    Here is a link to the GitHub repo: https://github.com/rjstelling/PhotoAlbumAndLibraryFiller