
How to Safely Display Your App Icon In-App (iOS & macOS, pre-26 and 26)
If you’ve ever wanted to show your app icon inside a SwiftUI
view, maybe in your About screen, a settings header, or during onboarding, you might have reached for UIImage(named:"AppIcon")
(or its NSImage
counterpart) and found it often just worked.
But I realized the other day, on iOS 26, that can suddenly crash.
Here’s how I set up a reusable SwiftUI
AppIcon
view years ago, how it evolved over the years, remained the same with the introduction of Apple's Icon Composer, and what changed when I ran my apps on the iOS 26 beta. The good news: the fix was simple, and the end result is a component you can copy-paste into your own apps today.

TL;DR: Copy-Paste Component
The Component
import SwiftUI
public struct AppIcon: View {
public var placeholderIconName: String = "AppIcon" // primary try
public var placeholderIconBackupName: String = "AppIconBackup" // fallback
public init(setIconName: String? = nil, setBackupName: String? = nil) {
if let thisName = setIconName, !thisName.isEmpty {
placeholderIconName = thisName
}
if let thisName = setBackupName, !thisName.isEmpty {
placeholderIconBackupName = thisName
}
}
#if os(macOS)
var resolvedImage: NSImage? {
NSImage(named: placeholderIconName)
?? Bundle.main.iconFileName.flatMap { NSImage(named: $0) }
?? NSImage(named: placeholderIconBackupName)
}
#else
var resolvedImage: UIImage? {
UIImage(named: placeholderIconName)
?? Bundle.main.iconFileName.flatMap { UIImage(named: $0) }
?? UIImage(named: placeholderIconBackupName)
}
#endif
public var body: some View {
Group {
#if os(macOS)
if let iconImage = resolvedImage {
Image(nsImage: iconImage)
.cornerRadius(10.0)
} else {
EmptyView()
}
#else
if let iconImage = resolvedImage {
Image(uiImage: iconImage)
.cornerRadius(10.0)
} else {
EmptyView()
}
#endif
}
}
}
Usage
HStack {
Spacer()
AppIcon() // falls back to AppIconBackup if needed
Spacer()
}
How I Got Here
The original component
I originally wrote a super simple version of this back in my very first app, targeting iOS 17 and macOS 14. At the time simply fetching the Bundle.main.iconFileName
and converting it to an image simply worked.
Bundle.main.iconFileName
#if os(macOS)
.flatMap { NSImage(named: $0) }
.map { Image(nsImage: $0) }
#else
.flatMap { UIImage(named: $0) }
.map { Image(uiImage: $0) }
#endif
.cornerRadius(10.0)
Evolution
I kept that original code around but kept adding little improvements as I added more apps to my library and used it in more views. This eventually ended up as the above code sample.

Enter Icon Composer
After WWDC 2025, I experimented with Apple’s new Icon Composer tool to redo all my favorite app icons. I upgraded my iPad to the current 26 beta software, added the new icons to my projects, kept the original AppIcon asset in the catalog, made sure they were named the same, and let Apple choose which icon to use based on your operating system. Everything looked and worked fine.
Then came iOS 26
Although I had tested my apps on my iPad it wasn't until recently when I upgraded my main phone to the current iOS 26 beta software that I noticed any problems. I just tested and uploaded the new charting upgrade to Simply Remember It and was dismayed to realize since the update the app crashed whenever a view tried to load the app icon.
When run through Xcode the console showed:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Need an imageRef'
Not sure the exact technical cause but according to ChatGPT it turned out that on iOS 26, the launcher AppIcon
asset isn’t always a plain raster. Calling it with UIImage(named:)
could resolve to a special internal rendition and that object had no CGImage
. Hence the crash.
The Fix
A Backup Image Asset
After trying to find code fixes I realized I, fortunately, already had the answer in my code by using the placeholderIconBackupName
in the component. All I needed to do was:
- Open my asset catalog and select the
AppIcon
image set. - Right-click the 1024px iOS image and copy it.

- Select the pane where the AppIcon is and hit past. A new image with that copied image will be added to the asset catalog.

- Either double click on the new image to edit the name OR (like here) open the right sidebar and change the name.

- Click off it and the name has been set to match the backup string. If you override the main or backup name when calling
AppIcon
you could set and pass in any unique name here.

And that’s it. No code changes. Simply Remember It stopped crashing on iOS 26 and the same code also works pre-26.
No code changes were required.
Real-World Test
I assumed the same issue would exist in my other apps but I somehow couldn’t reproduce the crash in them. That said, just in case it did affect them in the future I replicated the same steps to create a backup asset for each of them and pushed the update for all of them (more on that story here).

If You’re Starting Fresh on iOS 26
If you’re coding a brand new app using the new icon composer app icon I could see skipping the AppIcon in the assets entirely and instead just including a single PNG export as your display asset. That said, if you want compatibility across OS versions, or if you already have code referencing AppIcon, having both the app icon set up and an secondary AppIconBackup
image seems to be the safest path.
Why Share This?
I remember wanting to display the app icon internally in my apps years ago and when fixing this bug I figured someone else may want to do the same. If you have a better solution I'd love for you to share it in the comments below for anyone reading this. And regardless I thought this is a simple peek behind the scenes of how small fixes ripple across my apps.
I love that the fix itself was simple, literally just copy, paste, rename, but it also reinforced a bigger lesson: if you display your app icon inside the app treat it like any other image asset.
And like always I hope you’re having a great day.
If you’re interested in getting any of my future blog updates I normally share them to my Facebook page and Instagram account. You’re also more than welcome to join my email list located right under the search bar or underneath this post.