Skip to content

Commit 82a9a9a

Browse files
committed
Made Range init disfavoured, updated HoverExample
Should work on all platforms supporting ForEach as its just another initializer
1 parent 9f6528c commit 82a9a9a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Examples/Sources/HoverExample/HoverApp.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ struct HoverExample: App {
1313
WindowGroup("Hover Example") {
1414
#hotReloadable {
1515
VStack(spacing: 0) {
16-
ForEach([Bool](repeating: false, count: 18)) { _ in
16+
ForEach(1...18) { _ in
1717
HStack(spacing: 0) {
18-
ForEach([Bool](repeating: false, count: 30)) { _ in
18+
ForEach(1...30) { _ in
1919
CellView()
2020
}
2121
}

Sources/SwiftCrossUI/Views/ForEach.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ extension ForEach where Child == [MenuItem] {
1919
}
2020

2121
extension ForEach where Items == [Int] {
22+
/// Creates a view that creates child views on demand based on a given ClosedRange
23+
@_disfavoredOverload
2224
public init(
2325
_ range: ClosedRange<Int>,
2426
child: @escaping (Int) -> Child
@@ -27,6 +29,8 @@ extension ForEach where Items == [Int] {
2729
self.child = child
2830
}
2931

32+
/// Creates a view that creates child views on demand based on a given Range
33+
@_disfavoredOverload
3034
public init(
3135
_ range: Range<Int>,
3236
child: @escaping (Int) -> Child

0 commit comments

Comments
 (0)