Juanpe / SkeletonView

☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
MIT License
12.62k stars 1.12k forks source link

Momory Leak #570

Open parmar-mehul opened 5 months ago

parmar-mehul commented 5 months ago

Description

Describe your issue here.

What type of issue is this? (place an x in one of the [ ])

Requirements (place an x in each of the [ ])


Bug Report

SkeletonView Environment:

SkeletonView version: 1.31.0 Xcode version: Version 15.4 (15F31d) Swift version: 5.10

Steps to reproduce:

Please replace this with the steps to reproduce the behavior.

  1. Change rootViewController
  2. Previous controller unable to deinit because of SkeletonCollectionViewDataSource
  3. Attached screenshot

Expected result:

App should release object and view Controller should deinit

Actual result:

Getting strong object in memory even after changing pop or dismiss view controller

Attachments:

Logs, screenshots, sample project, funny gif, etc.

code,

extension DashboardVC : SkeletonCollectionViewDataSource {
    func collectionSkeletonView(_ skeletonView: UICollectionView, cellIdentifierForItemAt indexPath: IndexPath) -> SkeletonView.ReusableCellIdentifier {
        return "ConsultCell"
    }

    func collectionSkeletonView(_ skeletonView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        var count = self.arrRecentConsult.count
        if count == 0 {
            count = 1
        }

        return count
    }

    func collectionSkeletonView(_ skeletonView: UICollectionView, skeletonCellForItemAt indexPath: IndexPath) -> UICollectionViewCell? {
        let cell = skeletonView.dequeueReusableCell(withReuseIdentifier: "ConsultCell", for: indexPath) as! ConsultCell
        return cell
    }
}

Screenshot 2024-05-30 at 8 20 08 PM Screenshot 2024-05-30 at 8 18 07 PM