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...
Hello @steve_mcc,
This is interesting. It appears related to how SF Symbol glyph data is cached at runtime.
The closest mention I found is WWDC 2019 Session 206 Introducing SF Symbols, which states the system already optimizes SF Symbol performance internally, which makes this first-install cache miss worth investigating as a bug.
Please file a bug report using Feedback Assistant, and attach this code as a sample project with steps to reproduce the issue. Reply with the feedback number and I’ll make sure that report is seen by the relevant engineering team.
As a workaround, use a ZStack with opacity so both symbols are always in the hierarchy and get cached on first render, before the switch occurs:
let isFinished = currentItem == totalItems
ZStack {
Image(systemName: "arrowshape.right")
.opacity(isFinished ? 0 : 1)
Image(systemName: "arrowshape.turn.up.right")
.opacity(isFinished ? 1 : 0)
}
You can also try an overlay for the same effect.
If you consistently see different result for different symbols, that definitely sounds like a bug. If this is the case, in your report be sure to include what symbols you noticed made a difference.
Thanks for reporting!
Travis