Fuse: ForEach crashes with closed ranges at runtime
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 3.2k
- Forks
- 106
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
This code succeeds in Skip Lite but fails at runtime in Skip Fuse. (See also https://github.com/skiptools/skip.dev/issues/12)
It seems like it might not be possible to fix this, but, in that case, it should at least fail at build time instead of at runtime…?
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
ForEach(0...2, id: \.self) { index in
Text("hello \(index)")
}
}
}
}
Logcat shows this error:
Could not cast value of type '(extension in Swift):Swift.ClosedRange<Swift.Int>.Index' (0x6f64ae4570) to 'Swift.Int' (0x6f649bd7e8).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided SwiftUI ForEach reproduction using the closed range 0...2, and compare how Skip Lite and Skip Fuse handle ClosedRange indexes. The work is done when the example no longer crashes at runtime, or when unsupported usage fails at build time as requested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100