Skip to content

Instantly share code, notes, and snippets.

@acwright
Last active July 26, 2020 19:44
Show Gist options
  • Save acwright/0d4fabb44122e3b8824d924332af53c0 to your computer and use it in GitHub Desktop.
Save acwright/0d4fabb44122e3b8824d924332af53c0 to your computer and use it in GitHub Desktop.
DocExample ReferenceFileDocument protocol methods
func snapshot(contentType: UTType) throws -> String {
return self.text
}
func write(snapshot: String, to fileWrapper: inout FileWrapper, contentType: UTType) throws {
let data = snapshot.data(using: .utf8)!
fileWrapper = FileWrapper(regularFileWithContents: data)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment