Instance member cannot be used on type of custom class

前端 未结 3 1357
耶瑟儿~
耶瑟儿~ 2020-11-28 00:06

I have a classe named \"whisky builder\" which only initiates the new Whisky. Now i would like to add the new added whiskies in my \"WhiskyOverViewController\". But I face t

3条回答
  •  情深已故
    2020-11-28 00:41

    What you need there is a read only computed property:

    var stringArray: [String] { 
        return whiskyArray.map{$0.whiskyName!} 
    }
    

提交回复
热议问题