I am making a multiple images upload process; I want user to preview their chose images and add some description for images. In here, I make a collection view inside a table view, I want the images show in collection view cell, but I don’t know what I should code to call the images that user picked.
This is image picker controller
@objc func btnClick() {
let picker = YPImagePicker(configuration: config)
picker.didFinishPicking { [unowned picker] items, _ in
if let photo = items.singlePhoto {
print(photo.fromCamera) // Image source (camera or library)
print(photo.image) // Final image selected by the user
print(photo.originalImage) // original image selected by the user, unfiltered
print(photo.modifiedImage) // Transformed image, can be nil
print(photo.exifMeta) // Print exif meta data of original image.
}
picker.dismiss(animated: true, completion: nil)
}
present(picker, animated: true, completion: nil)
picker.didFinishPicking { [unowned picker] items, cancelled in
for item in items {
switch item {
case .photo(let photo):
print(photo)
case .video(let video):
print(video)
}
}
picker.dismiss(animated: true, completion: nil)
}
}
performSegue(withIdentifier: "UploadTableViewController", sender: nil)
here is in the tableView controller
func collectionView(collectionView: UICollectionView,
cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("UploadCollectionViewCell",
forIndexPath: indexPath)
cell.image?.UIImageView =
return cell
}