【发布时间】:2014-06-13 14:08:46
【问题描述】:
我有一些看起来像这样的快速代码:
class GeoRssItem
{
var title = ""
var description = ""
}
在另一个类中,我将这个变量声明为:
var currentGeoRssItem : GeoRssItem? // The current item that we're processing
我将此成员变量分配为:
self.currentGeoRssItem = GeoRssItem();
然后当我尝试在 self.currentGeoRssItem Xcode 上分配一个属性时,自动完成:
self.currentGeoRssItem.?.description = "test"
然后失败并出现构建错误:
"Expected member name following '.'"
如何设置此属性?我已经阅读了文档,但它们不是很有帮助。
【问题讨论】:
标签: swift