2017-10-04 61 views
0

所以我与苹果的Using JSON with Custom Types教程进行操作,请通过故事板,和我碰到一个错误尝试以下操作:使用未申报类型的“解码的” /“可编码的”斯威夫特3

struct GroceryStoreService: Decodable { 
    let name: String 
    let aisles: [Aisle] 

    struct Aisle: Decodable { 
     let name: String 
     let shelves: [Shelf] 

     struct Shelf: Decodable { 
      let name: String 
      let product: GroceryStore.Product 
     } 
    } 
} 

只有我收到错误:

Use of undeclared type Decodable - 与Codable相同。

我检查了其他SO问题,尝试清理和构建,戳穿构建阶段,迄今为止没有得到该排序的运气。

+4

难道你需要的Xcode 9 /斯威夫特4解码/可编码? – rmaddy

+2

是的,它只能在Swift 4中使用。 – Moritz

+0

哦,该死的它是新的?谢谢,我会升级。 – SQLiteNoob

回答