How to create UIImage in an extension - ShieldConfigurationExtension

I'm trying to modify a ShieldConfigurationExtension, but am having trouble adding an icon. I have tried directly adding a png to the ShieldConfiguration extension folder and creating a UIImage from it, but it doesn't seem to work. Am I working with images within an extension properly?

This code displays the default configuration

override func configuration(shielding application: Application, in category: ActivityCategory) -> ShieldConfiguration {
        // Customize the shield as needed for applications shielded because of their category.
       let image = UIImage(named: "icon")
       return ShieldConfiguration( icon: image)
    }

This code properly displays a customized configuration

return ShieldConfiguration( title: ShieldConfiguration.Label(text: "test", color: .white))

Replies

You can use UIImage(named: "icon") to create image in ShieldConfiguration. Just make sure the image is built into extension, check it at Build Phases for the shield configuration.