Created
August 30, 2018 11:44
-
-
Save acotilla91/e9ef0b82517cab9a2cda44b57c94154a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { | |
activityIndicator.startAnimating() | |
let person = persons[indexPath.item] | |
// Clear photos section | |
self.photos = [] | |
collectionView.reloadSections([photosSection]) | |
// Disable interactions while finding similar images | |
collectionView.isUserInteractionEnabled = false | |
// Find photos that match the selected avatar | |
AzureFaceRecognition.shared.findSimilars(faceId: person.faceId, faceIds: ContentManager.shared.allPhotosFaceIds) { (faceIds) in | |
self.photos = ContentManager.shared.photos(withFaceIds: faceIds) | |
self.collectionView.reloadSections([self.photosSection]) | |
self.collectionView.isUserInteractionEnabled = true | |
self.activityIndicator.stopAnimating() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment