Xcode报错:No exact matches in call to initializer
Xcode报错:No exact matches in call to initializer

Xcode报错:No exact matches in call to initializer

问题描述

在Xcode中显示Text文本时报如下错误:

No exact matches in call to initializer

经查询发现问题为Text视图只接受String类型的值,因此需要将selectedNumber字段转为字符串才能显示。

解决方案

         使用插值的方式,将selectedNumber由Number类型转换为String类型。

Text(selectedNumber)

如果您认为这篇文章给您带来了帮助,您可以在此通过支付宝或者微信打赏网站开放者。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注