StableView

main

A TableView implementation that can preserve position for iOS and macOS
mattmassicotte/StableView

Build Status Platforms Documentation Matrix

StableView

A list implementation that can preserve position

This is a SwiftUI wrapper around NS/UITableView. It is superfically-similar to SwiftUI's List, but with an additional property that can be used to control scroll position.

Warning

I'm just experimenting at the moment. This only kind of works.

Integration

dependencies: [
    .package(url: "https://github.com/mattmassicotte/StableView", branch: "main")
]

Usage

The position preservation system works via the scrollState binding.

struct AnchoredView: View {
    let items = ["one", "two", "three"]
    @State private var position: AnchoredListPosition<String>? = AnchoredListPosition(item: "two")

    public var body: some View {
       AnchoredList(items: items, position: $position) { item, row in
           Text("item: \(item)")
       }
    }
}

Contributing and Collaboration

I would love to hear from you! Issues or pull requests work great. Both a Matrix space and Discord are available for live help, but I have a strong bias towards answering in the form of documentation. You can also find me on the web.

I prefer collaboration, and would love to find ways to work together if you have a similar project.

I prefer indentation with tabs for improved accessibility. But, I'd rather you use the system you want and make a PR than hesitate because of whitespace.

By participating in this project you agree to abide by the Contributor Code of Conduct.

Description

  • Swift Tools 6.0.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri May 16 2025 12:10:51 GMT-0900 (Hawaii-Aleutian Daylight Time)