I am trying to include custom symbol resources in a swift package for use in other projects. I have read the documentation here: https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package
However there is no example code and I have created a very simple project to try and get this working but it does not.
.target(
name: "TestLibrary",
resources: [.process("Resources/Media.xcassets")]
),
This is in the Package.swift
file and the path relative to the Package.swift
file is Sources/TestLibrary/Resources/Media.xcassets
.
There's a GitHub project with an example custom SF Symbol SVG (but this may not be available in the future): https://github.com/kudit/TestLibrary
Including this as a package in a blank Swift Playgrounds App project and just importing the TestLibrary
and including TestImageView()
in the ContentView technically works (it shows the system full star image, but none of the ways of rendering the test symbol as recommended works. It does work for a few of the options in the #Preview
when viewing the project in Xcode.
Anyone have any suggestions or know how to get the resources to be accessible from outside the module? I have tried both the .copy(
option as well as the .process(
option and neither seem to work.