2017-10-04 64 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

回答