ios - How to dynamically add elements to UICollectionView as they are loaded from REST service (Swift) -
how can elements added dynamically uicollectionview loaded memory rest service?
right i'm calling
.reloaddata()
on uicollectionview iboutlet, not believe best practice.
i've tried performbatchupdate, didn't manage work.
self.photocollview.performbatchupdates({ self.photocollview.insertitemsatindexpaths(nsarray(object: photo) [anyobject]) }, completion: nil)
here i'm trying insert photo object photocollview iboutlet of uicollectionview.
@iboutlet var photocollview: uicollectionview!
i appreciate example.
there's many approachs, can use reloaddata() function if doing small amount of changes. how small are, need performance test.
another approach perform batch updates, can "segmented" in small amounts, don't need input data came rest service in 1 input. check more in collectionview programing guide apple
by way, reload data can deal pretty good, it's , needs.
Comments
Post a Comment