In my app I am getting all photos(PHAsset) using this code
PHPhotoLibrary.requestAuthorization { (status) in
switch status {
case .authorized:
print("Good to proceed")
let fetchOptions = PHFetchOptions()
let allPhotos = PHAsset.fetchAssets(with: .image, options: fetchOptions)
print("Found \(allPhotos.count) images")
case .denied, .restricted:
print("Not allowed")
case .notDetermined:
print("Not determined yet")
@unknown default:
fatalError()
}
}
I have two questions:
- Can I get grouped photos by categories from Photo Library? (see image below)
- Can I group photos by categories in my side? (see image below)

It seems not can implement it directly.
But,you can classify by system smart album、moments or album(the result is PHAssetCollection type).
Swift 5
Smart Album
Moments
Album
and also can display the user's album(the fetch result is a PHCollection type that contained user collections)
Besides: You needn't request authorization every time, the system will alert the user and request authorization at your first call every related function.
There is a sample code about browsing photos.Browsing and Modifying Photo Albums