[英]How do I initialize an empty NSMutableAttributedString in swift?
With this code it tells me that 'String' is not convertible to 'NSMutableAttributedString'
有了这段代码,它告诉我
'String' is not convertible to 'NSMutableAttributedString'
var textViewString:NSMutableAttributedString = ""
How do I properly initialize this string as empty? 如何正确将此字符串初始化为空? (It needs to be empty as I iterate through a loop appending items to the string.)
(当我遍历将字符串追加到字符串的循环时,它必须为空。)
您可以这样定义
var textViewString = NSMutableAttributedString(string: "")
您可以简单地使用以下命令创建一个空的可变属性字符串
var textViewString = NSMutableAttributedString()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.