Swift has functions map and flatmap. It there any equivalent in Objective-C? I've been trying to translate parts of Apple's Photos Example to use in my own Objective-C code. The particular code using this is as follows:
fileprivate func updateCachedAssets() {
    // Update only if the view is visible.
    guard isViewLoaded && view.window != nil else { return }
    // The preheat window is twice the height of the visible rect.
    let visibleRect = CGRect(origin: collectionView!.contentOffset, size: collectionView!.bounds.size)
    let preheatRect = visibleRect.insetBy(dx: 0, dy: -0.5 * visibleRect.height)
    // Update only if the visible area is significantly different from the last preheated area.
    let delta = abs(preheatRect.midY - previousPreheatRect.midY)
    guard delta > view.bounds.height / 3 else { return }
    // Compute the assets to start caching and to stop caching.
    let (addedRects, removedRects) = differencesBetweenRects(previousPreheatRect, preheatRect)
    let addedAssets = addedRects
        .flatMap { rect in collectionView!.indexPathsForElements(in: rect) }
        .map { indexPath in fetchResult.object(at: indexPath.item) }
    let removedAssets = removedRects
        .flatMap { rect in collectionView!.indexPathsForElements(in: rect) }
        .map { indexPath in fetchResult.object(at: indexPath.item) }
    // Update the assets the PHCachingImageManager is caching.
    imageManager.startCachingImages(for: addedAssets,
        targetSize: thumbnailSize, contentMode: .aspectFill, options: nil)
    imageManager.stopCachingImages(for: removedAssets,
        targetSize: thumbnailSize, contentMode: .aspectFill, options: nil)
    // Store the preheat rect to compare against in the future.
    previousPreheatRect = preheatRect
}
I have managed to translate the routine indexPathsForElementsIn:rect. I just don't understand map and flatmap functions well enough to generate something equivalent.
 
    