简体   繁体   中英

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.

在此输入图像描述

Xcode propose all the images, it looks really interesting but if it's just to "show" I would be sad :(

在此输入图像描述

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.

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):

图像文字推断类型

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM