Ceylo/ListItemTracking

Get notified about all frame changes for the items in a SwiftUI List.

★ 13Forks 1SwiftGitHub ↗Compare
listswiftui

README

ListItemTracking

ListItemTracking allows getting notified about all frame changes for the items in a SwiftUI List.

Minimal usage is as follow:

struct ContentView: View {
    var body: some View {
        GeometryReader { geometry in
            List(0..<100) { i in
                Text("Item \(i)")
                    .onItemFrameChanged(listGeometry: geometry) { (frame: CGRect?) in
                        print("rect of item \(i): \(String(describing: frame)))")
                    }
            }
            .trackListFrame()
        }
    }
}

Contributors

Ceylo

Issues