Created
April 18, 2016 00:52
-
-
Save cnharris10/72bcf7239875b667b08eacee8b1ec385 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import HanekeSwift | |
override viewDidLoad() { | |
let cache = Cache<JSON>(name: "github") // Set as instance variable | |
cacheImages() | |
refreshItems() | |
} | |
func cacheImages() { | |
for image in arrayOfImages { | |
let url = NSURL(string: image.url)! | |
cache.fetch(URL: url).onSuccess { JSON in | |
print(JSON.dictionary?["bio"]) | |
} | |
} | |
} | |
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { | |
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("imageReuseCell", forIndexPath: indexPath) as! ImageCollectionViewCell | |
let image = hingeImagesArray[indexPath.row] | |
if let imageURL = image.imageUrl as? NSURL { | |
cell.collectionView.image = hnk_setImageFromURL(imageUrl!) | |
} | |
return cell | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment