Delete and Move Rows | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/15234721-your-second-ios-and-swiftui-app/lessons/25

Upon importing Library.swift from 25-delete-and-move-rows/Starter/ReadMe/ReadMe/Library.swift into my ongoing project let me with the following errors:

  • /Library.swift:133:10: Class 'JSONDecoder' requires that 'Book' conform to 'Decodable'
  • /Library.swift:206:12: Class 'JSONEncoder' requires that 'Book' conform to 'Encodable'

Fixing this was as easy as adding the Codable type to Book:

class Book: ObservableObject, Codable

I might have missed adding this type to Book in a previous lesson, but I don’t recall it!