[英]XCode XCAssets and autocompletion
I was wondering if anyone knew if the XCAsset symbols provided in autocompletion can be used in any way, I imagine something but it didn't worked. 我想知道是否有人知道自动完成中提供的XCAsset符号是否可以以任何方式使用,我想象但是它没有用。
Xcode propose all the images, it looks really interesting but if it's just to "show" I would be sad :( Xcode提出所有的图像,它看起来真的很有趣,但如果只是为了“显示”我会很伤心:(
What you're seeing there is an image literal . 您所看到的是图像文字 。 It's not the name for the image, it is the image — so using one is equivalent to the entire
UIImage(named: "icon-stack")
call, not just the "icon-stack"
string within that call. 这不是针对图像的名字,它是图像-因此,使用一个相当于整个
UIImage(named: "icon-stack")
调用,而不仅仅是"icon-stack"
该呼叫中的字符串。
If you assign one of these directly to a var
or let
, you'll see that its inferred type is UIImage
(or NSImage
if targeting macOS): 如果将其中一个直接分配给
var
或let
,您将看到其推断类型为UIImage
(如果定位macOS,则为NSImage
):
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.