title: Swift/macOS: how to open odt (open document format) in Text View?
body: <p>I'm trying to make a small macOS viewer app that will display the content of ODT (Open Document) files but not allow editing in the way that TextEdit does. With the help of an online tutorial I've put together an RTF viewer that includes this code in Document.swift:</p>
  
  <pre><code>override func read(from data: Data, ofType typeName: String) throws {
       if let contents = NSAttributedString(rtf: data, documentAttributes: nil) {
          text = contents
      }
  }
  </code></pre>
  
  <p>What I can't figure out is how to make the program read ODT data instead of RTF data, and I can't find any documentation that helps out. So my question is: How can I rewrite that code to read in an ODT file instead of an RTF file?</p>