{"action":"closed","issue":{"url":"https://api.github.com/repos/firebase/FirebaseUI-iOS/issues/90","repository_url":"https://api.github.com/repos/firebase/FirebaseUI-iOS","labels_url":"https://api.github.com/repos/firebase/FirebaseUI-iOS/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/firebase/FirebaseUI-iOS/issues/90/comments","events_url":"https://api.github.com/repos/firebase/FirebaseUI-iOS/issues/90/events","html_url":"https://github.com/firebase/FirebaseUI-iOS/issues/90","id":167686429,"number":90,"title":"Lazy loading FIRStorage images with FirebaseCollectionViewDataSource (Swift)?","user":{"login":"heydana","id":6992884,"avatar_url":"https://avatars.githubusercontent.com/u/6992884?v=3","gravatar_id":"","url":"https://api.github.com/users/heydana","html_url":"https://github.com/heydana","followers_url":"https://api.github.com/users/heydana/followers","following_url":"https://api.github.com/users/heydana/following{/other_user}","gists_url":"https://api.github.com/users/heydana/gists{/gist_id}","starred_url":"https://api.github.com/users/heydana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heydana/subscriptions","organizations_url":"https://api.github.com/users/heydana/orgs","repos_url":"https://api.github.com/users/heydana/repos","events_url":"https://api.github.com/users/heydana/events{/privacy}","received_events_url":"https://api.github.com/users/heydana/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/firebase/FirebaseUI-iOS/labels/feature:database","name":"feature:database","color":"1d76db"},{"url":"https://api.github.com/repos/firebase/FirebaseUI-iOS/labels/feature:storage","name":"feature:storage","color":"bfd4f2"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-26T19:08:26Z","updated_at":"2016-08-11T23:56:40Z","closed_at":"2016-08-11T23:56:40Z","body":"I'm currently setting images within populateCellWithBlock using a FIRStorage ref and dataWithMaxSize method. The images show, but as you scroll, there is a flicker of a previous image from the reused cell.\r\n\r\n      self.dishesSource.populateCellWithBlock() {\r\n            \r\n            let cell = $0 as! dishCVCell\r\n            let dish = $1 as! Dish\r\n                \r\n            let dishImgRef = FIRStorage.storage().referenceForURL(dish.imageURL)\r\n            dishImgRef.dataWithMaxSize(1 * 1024 * 1024) { (data, error) -> Void in\r\n                if (error != nil) {\r\n                    print(error)\r\n                } else {\r\n                    cell.dishPhoto.image = UIImage.init(data: data!)\r\n                }\r\n            }\r\n        }\r\n\r\nTo avoid having a previous image flicker, I've set the image to nil in the prepareForReuse method within my custom CollectionView Cell:\r\n```\r\noverride func prepareForReuse() {\r\n        dishPhoto.image = nil\r\n    }\r\n```\r\n\r\nIt works, but I was wondering if there was a more efficient/lazy loading way to load cell images in the background when using FirebaseUI FirebaseCollectionViewDataSource?"}}
{"actor":{"display_login":"morganchen12"}}