1

I understand how one can create a folder programmatically using Apple's PhotoKit API and add Photos to the folder.

    PHPhotoLibrary.shared().performChanges({
        let req = PHAssetCollectionChangeRequest.creationRequestForAssetCollection(withTitle: "FolderName")

    }, completionHandler: { success, error in
        if !success { print("Error creating album: \(String(describing: error)).") }
    })

Is there a way to create subfolders inside this folder using PhotoKit?

  • You can try this one: https://developer.apple.com/documentation/photokit/phcollectionlistchangerequest/1622851-addchildcollections – SoftDesigner Jun 01 '20 at 12:44

2 Answers2

1

At present Apple is exposed api for create single album. Even manually you can't create a folder inside another folder from the device.

Andrew
  • 26,706
  • 9
  • 85
  • 101
AshokPolu
  • 645
  • 5
  • 12
0

https://developer.apple.com/documentation/photokit/phcollectionlistchangerequest

Call the creationRequestForCollectionList(withTitle:) method to create a new asset collection.

Call the deleteCollectionLists(_:) method to delete existing asset collections.

Call the init(for:) or init(for:childCollections:) method to modify a collection’s metadata or its list of child collections.

Aditya Malviya
  • 1,907
  • 1
  • 20
  • 25