Create PDF in Swift

 ̄綄美尐妖づ 提交于 2019-12-01 10:39:19

First you have to give it an explicit optional type (using the ?):

var currentText: CFAttributedStringRef? = ...

Then you can compare it to nil:

if currentText != nil {
    // good to go
}

Your code compiles at the moment, because Apple hasn't yet "swiftified" CoreFoundation to return properly annotated types.

Be prepared that in the final release your code will not even compile, forcing you to use the optional type.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!