Xcode 10-图像文字不再可用 [英] Xcode 10 - image literals no longer available

查看:86
本文介绍了Xcode 10-图像文字不再可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Xcode 10发行说明:已在Xcode 10中删除了Swift图像文字的代码完成功能"

Xcode 10 Release Notes: "Code Completion for Swift image literals has been removed in Xcode 10"

所以我不能在代码中添加图像(并运行较旧的项目)不是一个错误.从现在开始,如何在代码中添加图像,因为仅键入UIImageView(image:将不接受任何png或jpeg.

So it's not a bug that I couldn't add images in the code (and run older projects). How do we then add images from now on in the code as just typing UIImageView(image: won't accept any png or jpeg.

let cellImage: UIImageView = {
    let image = UIImageView(image: ???))

    return image
}()

系统:macOS Mojave
Xcode:Xcode 10 Beta 4

System: macOS Mojave
Xcode: Xcode 10 Beta 4

推荐答案

Xcode 10和Swift 4.2 中,仅Xcode IDE的代码完成功能(或自动完成)已停止使用旧的方式.这是新方法:

In Xcode 10 and Swift 4.2, only the code completion function (or auto-complete) of the Xcode IDE has been discontinued for the old way. Here is the new way:

只需键入image literal,它将完成并带有默认图标.

Just type image literal and it will complete with default icon.

 

双击该图标,它将打开它右侧的媒体库.

Double click on this icon and it will open the media library right side of it.

 

只需选择您的图像,它就会像以前一样工作!

Just choose your imagem and it work like before!

这篇关于Xcode 10-图像文字不再可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆