Error in UICollectionView reloadData


What I do:
rootVC —> modalView1 —> modalView2 —> modalView3 —> dismiss modalView3 to rootVC then reload collectionView

dismissing to rootVC is working but having errors occur during collectionView.reloadData()


Thanks in advance!

Project Repo:


hindi nman nil yung collection view?


usable ung collection view and working tlga xa…


After ng dismiss yung collectionview hindi nil?


as lper display, hindi xa nil and working p xa kung hindi ako magrereload…


how about yung actual [data] perhaps nil? Break point ka before reload then open mo yung variables view para makita mo yung mga objects


i just tried breakpoints… nil nga xa, pero panu n gagawin dun? :frowning:


check mo yung collectionview is created and how it is destroyed/deallocated


aw!! panu un?! :frowning:


PM me sa slack. We will share the solution later


pm sent… :frowning:


paanu ka magdismiss? and saang part ng code mu tinatawag ung displaySlots() ? :slight_smile:


just added a project repo… thanks! :frowning:


The last VC is referencing a new instance of the root therefore the outlets are not properly set. In this case I suggest to use an unwind segue


Uu tama si @nmariano

hindi ku mapagana ung project hehe

Siguro simplest way is add mu ito

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        if segue.identifier == "firstSegue" {
            if let secondModal = segue.destinationViewController as? SecondModal {
                secondModal.delegate = self
extension RootViewController: SecondModalDelegate {
    func goToRoot(_ viewController: SecondModal) {