Closed tonespy closed 8 years ago
There is a swift demo project too
I tried this
self.photoURLs = []
let fk = FlickrKit.sharedFlickrKit()
let interesting = FKFlickrInterestingnessGetList()
interesting.per_page = "5"
fk.call(interesting) {(response, error) -> Void in
dispatch_async(dispatch_get_main_queue(), { () -> Void in
if (response != nil) {
// Pull out the photo urls from the results
print(response)
let topPhotos = response["photos"] as! [NSObject: AnyObject]
let photoArray = topPhotos["photo"] as! [[NSObject: AnyObject]]
for photoDictionary in photoArray {
let photoURL = FlickrKit.sharedFlickrKit().photoURLForSize(FKPhotoSize.init(2), fromPhotoDictionary: photoDictionary)
print(photoURL)
self.photoURLs.append(photoURL)
}
//print(self.photoURLs)
} else {
print(error)
switch error.code {
case FKFlickrInterestingnessGetListError.ServiceCurrentlyUnavailable.rawValue:
break;
default:
break;
}
let alert = UIAlertView(title: "Error", message: error.localizedDescription, delegate: nil, cancelButtonTitle: "OK")
alert.show()
}
})
}
This line
let photoURL = FlickrKit.sharedFlickrKit().photoURLForSize(FKPhotoSize.init(2), fromPhotoDictionary: photoDictionary)
This is what's in the documentation for getting a particular image size
let photoURL = FlickrKit.sharedFlickrKit().photoURLForSize(FKPhotoSizeSmall240, fromPhotoDictionary: photoDictionary)
and FKPhotoSizeSmall240
gives me Ambigous reference to FKPhotoSize
@devedup
So do you get this when you try and compile the FlickrKitSwiftDemo app? Maybe you need to do a clean of your derived data directory.
I am trying to replicate this in swift