I have programmatically fetched the name of the image which i select from the photo library. Is there a way in swift to fetch that image from another view controller without using UIImagePickerController and only using its name programmatically ????
Sample code in swift would definitely help me.
This is the code which i have used to fetch the name of the image selected through UIImgepickerController
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
photoImageView.image = info[UIImagePickerControllerOriginalImage] as? UIImage
photoImageView.contentMode = UIViewContentMode.ScaleAspectFill
photoImageView.clipsToBounds = true
print("Media info = %@", info)
if let imageURL = info[UIImagePickerControllerReferenceURL] as? NSURL {
let result = PHAsset.fetchAssetsWithALAssetURLs([imageURL], options: nil)
filename = result.firstObject?.filename ?? ""
print("File name = \(filename)")
}
}