Skip to content

.delegate(self) cause a memory leak #48

@Channe

Description

@Channe

If I add a .delegate(self) to FlexLayoutViewController in demo project, it causes FlexLayoutViewController not to call the deinit method.

extension FlexLayoutViewController: UIScrollViewDelegate {
    func scrollViewDidScroll(_ scrollView: UIScrollView) {
      print("scrollViewDidScroll")
    }
}

class FlexLayoutViewController: ComponentViewController {
    deinit {
        print("FlexLayoutViewController deinit")
    }
}

line 72: add .delegate(self)

                    VStack {
                        Space(height: 10)
                        Text("VStack")
                        VStack(spacing: 10) {
                            for index in 0...10 {
                                Box(index)
                            }
                        }
                        .inset(10).scrollView()
                        .delegate(self)
                        .showsVerticalScrollIndicator(false).size(height: 310)
                    }
                    .inset(h: 10).styleColor(.systemGray4)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions