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

Minor Warnings Fix - Warnings and functionBuilder to @resultBuilder #24

Merged
merged 1 commit into from
Mar 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/PageControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public enum PageControl {
public let theme: PageControlTheme

public var body: some View {
ForEach(0..<pageCount) { (i) in
ForEach(0..<pageCount, id: \.self) { (i) in
Circle()
.frame(width: self.theme.dotSize, height: self.theme.dotSize)
.foregroundColor(self.dotColor(index: i))
Expand Down
4 changes: 2 additions & 2 deletions Sources/PageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public struct HPageView<Pages>: View where Pages: View {
theme: PageControlTheme = .default,
builder: @escaping (Int) -> ForEachContent
) where Pages == ForEach<Range<Int>, Int, ForEachContent> {
let forEachContainer = PageContainer(count: data.count, content: ForEach(data, content: builder))
let forEachContainer = PageContainer(count: data.count, content: ForEach(data, id: \.self, content: builder))
self.init(
selectedPage: selectedPage,
pageCount: data.count,
Expand Down Expand Up @@ -232,7 +232,7 @@ public struct VPageView<Pages>: View where Pages: View {
theme: PageControlTheme = .default,
builder: @escaping (Int) -> ForEachContent
) where Pages == ForEach<Range<Int>, Int, ForEachContent> {
let forEachContainer = PageContainer(count: data.count, content: ForEach(data, content: builder))
let forEachContainer = PageContainer(count: data.count, content: ForEach(data, id: \.self, content: builder))
self.init(
selectedPage: selectedPage,
pageCount: data.count,
Expand Down
2 changes: 1 addition & 1 deletion Sources/PageViewBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public struct PageContainer<Content>: View where Content: View {
Modified version of ViewBuilder, which does the counting of child views.
Other than that it works the same way as the original
*/
@_functionBuilder
@resultBuilder
public struct PageViewBuilder {
public static func buildBlock<Content>(_ c: Content) -> PageContainer<Content> {
return PageContainer(count: 1, content: c)
Expand Down