Screenshot of Xcode release notes: Asset Catalogs New Features Xcode now generates Swift and Objective-C symbols for each color and image in the asset catalog. These symbols provide a safer, more assistive way to reference assets that’s resilient to renames & typos, leverages compiler type checking, and integrates with code completion. Swift asset symbols are generated in the module associated with a given asset catalog. They’re generated as static properties on the new ColorResource and ImageResource types. To instantiate colors and images with asset symbols, use the SwiftUI, UIKit, and AppKit initializers that take the resource types. For example: Given an asset catalog with a color “spaceGray” and image “appleLogo”, instantiate the color symbol ColorResource.spaceGray with Color(.spaceGray), UIColor(resource: .spaceGray), and NSColor(resource: .spaceGray), and the image symbol ImageResource.appleLogo with Image(.appleLogo), UIImage(resource: .appleLogo), and NSImage(resource: .appleLogo). With the opt-in build setting “Generate Swift Asset Symbol Extensions” (ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS) set to YES, asset catalog colors and images can be accessed directly on system color and image types, e.g. Color.spaceGray, UIColor.spaceGray, NSColor.spaceGray, UIImage.appleLogo, and NSImage.appleLogo.
https://files.mastodon.social/media_attachments/files/110/493/709/774/971/951/original/16619777d8959fde.png