I'm using MWPhotoBrowser to display a single image in my app. I've set the class of my view controller to MWPhotoBrowser in the main storyboard and I've added the following code but the image fails to load.
let photos = NSMutableArray()
let photo = MWPhoto(URL: NSURL(string: "http://images.nationalgeographic.com/wpf/media-live/photos/000/911/cache/man-ocean-phytoplankton_91111_600x450.jpg"))
photos.addObject(photo)
self.photos = photos
self.displayActionButton = true
self.displayActionButton = true;
self.displayNavArrows = true;
self.displaySelectionButtons = true;
self.alwaysShowControls = true;
self.zoomPhotosToFill = true;
self.enableGrid = true;
self.startOnGrid = true;
self.enableSwipeToDismiss = true;
And these are the delegate methods. I noticed that we need a photoAtIndex which returns an MWPhoto but the delegate only has a function which returns an MWPhotoProtocol
func numberOfPhotosInPhotoBrowser(photoBrowser: MWPhotoBrowser!) -> UInt
{
return UInt(photos.count)
}
func photoBrowser(photoBrowser: MWPhotoBrowser!, photoAtIndex index: UInt) -> MWPhotoProtocol!
{
return photos.objectAtIndex(Int(index)) as! MWPhotoProtocol
}
I get the following screen: