SwiftUI-Notes icon indicating copy to clipboard operation
SwiftUI-Notes copied to clipboard

Buildtime Error: Use of undeclared type 'Note'

Open spetrey opened this issue 5 years ago • 1 comments

Hi there 👋 I was poking around this repo to get a better understanding of CloudKit. This is an awesome app! Thanks so much for putting this together. But, I can't seem to squash these Buildtime errors in Xcode 11 beta 4 😰

Use of undeclared type 'Note'

Type 'FetchedResultsController<ResultType>' does not conform to protocol 'BindableObject'

Note.body must have a default value [8]

Any help would be greatly appreciated! I'm still very much so a novice with Swift. Cheers!

spetrey avatar Jul 20 '19 14:07 spetrey

  1. This sort of undeclared type happens when it can't generate the core data class. So it's really a side effect of your third problem. The third problem is a change in Core Data's requirements: now, if a field is required (i.e., can't be null), it must have a default value defined in the xcdatamodeld file, and strings can't be empty. Bah.

  2. The second is a red herring because XCode is complaining in the wrong spot. The short version is that didChange changed to willChange, so if you replace those two instances, it'll compile.

See: https://developer.apple.com/documentation/swiftui/bindableobject

There are some other nits related to beta 4, so I'll put together a pull request.

deirdresm avatar Jul 23 '19 07:07 deirdresm