SwiftUI preview does not update when changing an Int range supplied to a ForEach
Originator: | indiekiduk | ||
Number: | rdar://FB10035120 | Date Originated: | 2/6/2022 |
Status: | Open | Resolved: | No |
Product: | Xcode | Product Version: | Version 13.4 (13F17a) |
Classification: | Bug | Reproducible: | Always |
Please describe the issue: I noticed that in Xcode, the SwiftUI preview canvas does not update when I change an Int range supplied to a ForEach. Please list the steps you took to reproduce the issue: I previewed the code below in the SwiftUI canvas, then I changed the ForEach from 1..<12 to 1..<13 import SwiftUI struct StackTestView: View { var body: some View { VStack( alignment: .leading, spacing: 10 ) { ForEach( 1..<12 ) { Text("Item \($0)") } } } } struct StackTestView_Previews: PreviewProvider { static var previews: some View { StackTestView() } } What did you expect to happen? I've attached a screenshot in this state. I expected the preview to update, i.e. a 12th row should appear. The resume button when the preview can't be dynamically updated didn't appear either. What actually happened? Nothing
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Screenshot
https://imgur.com/nbveDw0