Skip to content

Commit b70afde

Browse files
authored
Merge pull request #24 from ezefranca/master
Minor Warnings Fix - Warnings and `functionBuilder` to` @resultBuilder`
2 parents 059f893 + 332ca5e commit b70afde

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Sources/PageControl.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public enum PageControl {
6868
public let theme: PageControlTheme
6969

7070
public var body: some View {
71-
ForEach(0..<pageCount) { (i) in
71+
ForEach(0..<pageCount, id: \.self) { (i) in
7272
Circle()
7373
.frame(width: self.theme.dotSize, height: self.theme.dotSize)
7474
.foregroundColor(self.dotColor(index: i))

Sources/PageView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public struct HPageView<Pages>: View where Pages: View {
8282
theme: PageControlTheme = .default,
8383
builder: @escaping (Int) -> ForEachContent
8484
) where Pages == ForEach<Range<Int>, Int, ForEachContent> {
85-
let forEachContainer = PageContainer(count: data.count, content: ForEach(data, content: builder))
85+
let forEachContainer = PageContainer(count: data.count, content: ForEach(data, id: \.self, content: builder))
8686
self.init(
8787
selectedPage: selectedPage,
8888
pageCount: data.count,
@@ -232,7 +232,7 @@ public struct VPageView<Pages>: View where Pages: View {
232232
theme: PageControlTheme = .default,
233233
builder: @escaping (Int) -> ForEachContent
234234
) where Pages == ForEach<Range<Int>, Int, ForEachContent> {
235-
let forEachContainer = PageContainer(count: data.count, content: ForEach(data, content: builder))
235+
let forEachContainer = PageContainer(count: data.count, content: ForEach(data, id: \.self, content: builder))
236236
self.init(
237237
selectedPage: selectedPage,
238238
pageCount: data.count,

Sources/PageViewBuilder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public struct PageContainer<Content>: View where Content: View {
2323
Modified version of ViewBuilder, which does the counting of child views.
2424
Other than that it works the same way as the original
2525
*/
26-
@_functionBuilder
26+
@resultBuilder
2727
public struct PageViewBuilder {
2828
public static func buildBlock<Content>(_ c: Content) -> PageContainer<Content> {
2929
return PageContainer(count: 1, content: c)

0 commit comments

Comments
 (0)