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

Added new initializer to support a ForEach loop #15

Closed
wants to merge 1 commit into from

Conversation

sverin
Copy link

@sverin sverin commented Mar 16, 2021

The only init method available does not support a for each loop as the example below.

HPageView(selectedPage: $pageIndex) {      
    ForEach(images, id: \.self) { image in
        Image(uiImage: image.uiImage)
            .resizable()
            .scaledToFill()
    }
}

But this could be improved and supported by a new initializer

HPageView(selectedPage: $pageIndex, pageCount: images.count) {      
    ForEach(images, id: \.self) { image in
        Image(uiImage: image.uiImage)
            .resizable()
            .scaledToFill()
    }
}

@Lubakis
Copy link

Lubakis commented Apr 23, 2021

This is a much needed feature

@fredyshox
Copy link
Owner

Release 1.5.0 (#18) will contain ForEach-like inits for HPageView and VPageView. It's a little bit different than this one, but it prevents from unintentional inconsistency of data passed to PageView and ForEach. So I'm closing this one.

@fredyshox fredyshox closed this Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants