【发布时间】:2019-07-13 20:46:49
【问题描述】:
我有一些代码,但我没有全部。我了解有关 SwiftUI 和 Core Data 的代码基础知识,但我不知道如何在以下代码中编写 redFox 模型示例。
我尝试自己编写 redFox 代码,但没有成功。
import SwiftUI
struct AnimalCell : View
{
let model: AnimalCellModel
var body: some View
{
HStack
{
Text(model.image)
Text(model.commonName)
Text(model.familyName)
Text(model.scientificName)
}
}
}
#if DEBUG
public enum AnimalCellPreviews : PreviewProvider
{
public static var previews: some View
{
AnimalCell(model: .redFox)
}
}
#endif
我应该看到预览,但因为代码不完整而看不到。
【问题讨论】: