Git Product home page Git Product logo

swiftyuiscrollview's Introduction

SwiftyUIScrollView

A custom ScrollView wrapper that comes with Pagination and Page Control.

Wrap HStack or VStack with the custom SwiftUIScrollView to get pagination and page control features. The initializer for the wrapper is:

init(axis: DirectionX, numberOfPages: Int,
         pagingEnabled: Bool,
         pageControlEnabled: Bool,
         hideScrollIndicators: Bool,
         currentPageIndicator: UIColor?,
         pageIndicatorTintColor: UIColor?,
         @ViewBuilder content: @escaping () -> Content)

This is how the above custom wrapper could be used:

SwiftyUIScrollView(axis: .horizontal, numberOfPages: self.contentArray.count, pagingEnabled: true, pageControlEnabled: true, hideScrollIndicators: true) {
                    HStack(spacing: 0) {
                        ForEach(self.contentArray, id: \.id) { item in
                            TestView(data: item)
                                    .frame(width: g.size.width, height: g.size.height)
                        }
                    }
            }.frame(width: g.size.width)

The DirectionX enum contains two directions:

enum DirectionX {
    case horizontal
    case vertical
}

If you are using HStack, make sure you set the axis in initializer to- .horizontal, if using VStack make sure you use .vertical. This is madatory in order to have pagination and page controls to work for both directions.

swiftyuiscrollview's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

carabina rimasinc

swiftyuiscrollview's Issues

Permanent UI freeze on iOS 13.1

Hi this was working great for me on iOS 13.0, but since upgrading to 13.1, it appears to result in a permanent UI freeze. Have you experienced anything similar?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.