I'm getting a log error and a slight delay in the UI when displaying a system image that changes at the end of a sequence. I'm using a ternary operator to determine the image; the fact that the image changes seem to be the issue, rather than the value itself.
The issue only occurs for a newly installed app, and not when the app is rerun. (I'm using similar code to display an onboarding sequence after installation.)
This happens on device (iphone 15 pro v25.6) and simulator (iphone 17 pro v25.6 and iphone 16 pro v18.5); xcode 26.5 (17F42).
Console errors (device and iphone 17 simulator):
fopen failed for data file: errno = 2 (No such file or directory)
fopen failed for data file: errno = 2 (No such file or directory)
Repro Code:
import SwiftUI
struct ContentView: View {
// NOTE: error only occurs with new install.
@State private var currentItem = 0
@State private var totalItems: Int = 4
var body: some View {
VStack(spacing: 0) {
Spacer()
Text("totalItems: \(totalItems)")
TabView(selection: $currentItem) {
ForEach(0...totalItems, id: \.self) { item in
Text("\(item) ~ \(currentItem)")
.tag(item)
}
} //TV
.tabViewStyle(.page(indexDisplayMode: .never))
.frame(height: 200)
Button {
if currentItem < totalItems {
currentItem += 1
currentItem = min(totalItems, currentItem)
}
} label: {
let imgString: String = (currentItem == totalItems ? "arrowshape.turn.up.right" : "arrowshape.right") // error
// let imgString: String = ((currentItem == totalItems) ? "x.circle" : "smallcircle.filled.circle") // error
// let imgString: String = "smallcircle.filled.circle" // no error
// let imgString: String = "x.circle" // no error
Text("\(imgString)") // if only print text, no error, so issue seems to be with Image.
Image(systemName: imgString)
}
Spacer()
}
}
}
Click through the button sequence to see issue at end of sequence. Uncomment the various imgString lines to see indicated differences in behavior. Need to delete app each time to repro issue.
Running in simulator on iphone 16 Pro iOS 18.5 has slightly different error messages:
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
1
0
108