ImageViewer
ImageViewer copied to clipboard
How to get the current picture data?
For example: I have 9 pictures,want to get the third picture of the data
I want to know too.I have to save current photo but cannot get it.
GalleryViewController.currentIndex
I'm looking for something similar... right now I came up with something like this:
galleryViewController.landedPageAtIndexCompletion = { index in
let items = delegate.galleryItems
let focusedItem = items[index]
// try to get the image locally if possible, works for the initial image but not after that
if let image = focusedItem.imageView?.image {
shareView.image = image
return
}
shareView.image = nil // will be set below
switch focusedItem.galleryItem {
case .image(let imageCompletionBlock):
imageCompletionBlock { image in
shareView.image = image // my shareView is a custom view that allows saving the image
}
default: return
}
}
This works fine, but the downside is that I'm fetching the image a second time over the network just so I can get access to it for saving purposes. There are probably other ways of getting access to the image w/o fetching it twice but this works for now. I may add some image caching into my code that handles the actual request to avoid fetching extra data.