Skip to content

Commit

Permalink
Merge pull request #24 from ezefranca/master
Browse files Browse the repository at this point in the history
Minor Warnings Fix - Warnings and `functionBuilder` to` @resultBuilder`
  • Loading branch information
fredyshox authored Mar 11, 2023
2 parents 059f893 + 332ca5e commit b70afde
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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

0 comments on commit b70afde

Please sign in to comment.