Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leaking #441

Open
2 tasks done
kacperd opened this issue Oct 28, 2024 · 0 comments
Open
2 tasks done

Memory leaking #441

kacperd opened this issue Oct 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@kacperd
Copy link

kacperd commented Oct 28, 2024

Description

It looks like the IntrospectionAnchorPlatformViewController and IntrospectionPlatformViewController are never deallocated even though the SwiftUI views they are wrapping are not visible on the screen. This results in dozens of them being allocated and grows memory consumption.

Screenshot 2024-10-28 at 13 09 46

The code that I use is a view modifier to calculate global frame of the view using UIKit:

struct GlobalFrameCalculator: ViewModifier {

    @Binding var frame: CGRect?
    var callback: ((CGRect?) -> Void)?

    func body(content: Content) -> some View {
        content
            .introspect(.view, on: .iOS(.v15, .v16, .v17, .v18)) { view in
                let globalFrame = view.globalFrame
                frame = globalFrame
                callback?(globalFrame)
            }
    }
}

Is there something wrong with how I use introspect of is this a bug in the library?

Checklist

Expected behavior

No response

Actual behavior

No response

Steps to reproduce

No response

Version information

No response

Destination operating system

No response

Xcode version information

No response

Swift Compiler version information

No response

@kacperd kacperd added the bug Something isn't working label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant