swift - iOS UICollectionView navigation -
i'm trying figure out how navigate around app. i'm little lost.
i have uiviewcontroller loads data, displays data in collectionview. have uiviewcontroller detailed view. trigger segue go it, pass data etc.
self.performseguewithidentifier("detailviewseque", sender: nil)
but part i'm lost on getting main view, if trigger segue loads data / view again. data has been loaded once, don't want keep loading it.
i feel i'm doing things wrong, theres super obvious way handle scenario.
could point me in right direction?
to rephrase needs "i have data need keep around somewhere isn't associated view controller".
you have few options here. goal store somewhere isn't going go out of memory. appdelegate
gets used purpose lot singleton variable works well.
i create singleton, catpictureretriever
private let _catpictureretriever sharedinstance = catpictureretriever() class catpictureretriever { static let sharedinstance = catpictureretriever() var catpictures : nsarray?; func gimmecatpictures -> nsarray? { return catpictures } }
now can pictures though catpictureretriever anywhere
var pictures = catpictureretriever.sharedinstance.gimmecatpictures()
Comments
Post a Comment