如何在Swift(Xcode)中使用通配符从Assets.xcsets获取图像?

如何在Swift(Xcode)中使用通配符从Assets.xcsets获取图像?,swift,search,wildcard,assets,Swift,Search,Wildcard,Assets,我试图找到一些方法,如何使用通配符在Assets.xcsets中查找所有“leaf-*”图像,并将它们作为SKTexture加载到数组中。据我所知,仅从资产目录中的文件夹加载图像也是不可能的,对吗 let leafTexturesArray = [SKTexture(image: UIImage(named: "leaf-brown-1.png")!), SKTexture(image: UIImage(named: "leaf-brown-2.png")!), SKTexture(image:

我试图找到一些方法,如何使用通配符在Assets.xcsets中查找所有“leaf-*”图像,并将它们作为SKTexture加载到数组中。据我所知,仅从资产目录中的文件夹加载图像也是不可能的,对吗

let leafTexturesArray = [SKTexture(image: UIImage(named: "leaf-brown-1.png")!), SKTexture(image: UIImage(named: "leaf-brown-2.png")!), SKTexture(image: UIImage(named: "leaf-green-1.png")!), SKTexture(image: UIImage(named: "leaf-green-2.png")!), SKTexture(image: UIImage(named: "leaf-green-3.png")!)]
这很好用——但这似乎不是加载50种不同叶子纹理的干净方法

是否有类似于:

var finishedArrayWithAllLeafImages = [SKTextures]()
for image in Assets.xcassets {
   if "leaf*" is in images.filename {
      finishedArrayWithAllLeafImages.append(SKTexture(image: image.name))
   }
}
?

我试图找到其他方法让通配符工作,比如从项目中的文件夹中查找图像,但我看不到搜索通配符的意义

如果有人有任何提示或想法如何实现这个想法,那就太酷了

非常感谢