I recently observed some protocol changes to FileDocument in the Xcode 12 beta 6 release. It was easy enough to get my app working again, but I am having trouble updating my tests.
In my tests I programmatically create instances of my Document to verify it will migrate older file formats properly. With the updated FileDocument protocol I the init looks something like:
How do I initialize a ReadConfiguration in a test?
When I try to do it I get a error:
More info can be found on this GitHub issue:
https://github.com/zorn/VersionedFilesDemo/issues/1
In my tests I programmatically create instances of my Document to verify it will migrate older file formats properly. With the updated FileDocument protocol I the init looks something like:
Code Block swift init(configuration: ReadConfiguration) throws { guard let data = configuration.file.regularFileContents, let string = String(data: data, encoding: .utf8) else { throw CocoaError(.fileReadCorruptFile) } text = string }
How do I initialize a ReadConfiguration in a test?
When I try to do it I get a error:
Code Block // ERROR: 'PeopleDocument.ReadConfiguration' (aka 'FileDocumentReadConfiguration') cannot be constructed because it has no accessible initializers
More info can be found on this GitHub issue:
https://github.com/zorn/VersionedFilesDemo/issues/1