Skip to content

A CustomScrollView that supports scrolling to top, scroll to bottom and scroll to an content offset.

Notifications You must be signed in to change notification settings

phuhuynh2411/CustomScrollView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CustomScrollView

A CustomScrollView that supports scrolling to top, scroll to bottom and scroll to an content offset.

Custom scroll view

Support Platforms

  • iOS
  • macOS

Axis

  • Vertical (supported)
  • Horizontal (not available yet)

Key features

  • Scroll to top
  • Scroll to bottom
  • Scroll to an y offset
  • Show/hide vertical indicator

Usage

struct ContentView: View {
    @State var attribute = CustomScrollAttribute()
    
    var body: some View {
        VStack {
            VStack(alignment: .leading) {
                Button(action: {
                    self.attribute.scrollToBottom()
                }) {
                    Text("Scroll to bottom")
                }
                Button(action: {
                    self.attribute.scrollToTop()
                }) {
                    Text("Scroll to top")
                }
                Button(action: {
                    self.attribute.scrollTo(y: 200)
                }) {
                    Text("Scroll to y: 200")
                }
            }
            .padding()
            
            CustomScrollView(attribute: self.$attribute, showIndicators: true) {
                ForEach(0...100, id: \.self) { index in
                    VStack {
                        Text("Item \(index)")
                            .padding()
                            .background(Color.yellow)
                            .onTapGesture {
                        }
                        Divider()
                    }
                    
                }
            }
            
        }
    }
}

About

A CustomScrollView that supports scrolling to top, scroll to bottom and scroll to an content offset.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages