ios - why Reloading collection view in another class will cause Fatal Error in Swift 3? -
i have collection view in app in 1 class - have camera function in class want when take picture function execute in collection view class , want reload data in collection view cause fatal error
here camera class codes func imagepickercontroller(_ picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [string : any]) { let selectedimage = info[uiimagepickercontrolleroriginalimage] as! uiimage uiimagewritetosavedphotosalbum(selectedimage,self,nil,nil) oneviewcontroller().reloading() print("save image ") dispatchqueue.main.asyncafter(deadline: .now() + .seconds(3), execute: { self.dismiss(animated: true, completion: nil) })
and here oneview controller reloading function
public func reloading() { print("oky") viewdidload() viewwillappear(true) let allphotosoptions : phfetchoptions = phfetchoptions.init() allphotosoptions.sortdescriptors = [nssortdescriptor(key: "modificationdate", ascending: true)] let allphotosresult = phasset.fetchassets(with: .image, options: allphotosoptions) allphotosresult.enumerateobjects({ (asset, idx, stop) in let arry_img = nsmutablearray() self.arry_img.add(asset) self.arr_img = arry_img self.collview.reloaddata() }) }
Comments
Post a Comment