Post

Replies

Boosts

Views

Activity

Reply to Recommended or Typical UTI for Plain Text Editor App
Thanks Polyphonic! So, my current understanding is that Document Types, Name could be anything, but I suppose it may be seen by users somewhere. And Types should be public.plain-text. As for Imported Type Identifiers, I'm going with what's shown (generically) in the image below. After changing the Imported Type Identifiers, Identifier as shown, I needed to use the same value in the code created by the Doc App template. See the code below. I created two test apps using the Doc App template, GreenPurple1 and GreenPurple2, and they both created .txt files and they could (obviously?) open and edit files created by the other app. And per Polyphonic's recommendation to validate that my app has just opened (only) UTF8 data, I've searched for how this is done and it appears this won't be 10 lines of Swift code or fewer. But if you know otherwise, please share! import SwiftUI import UniformTypeIdentifiers extension UTType { static var exampleText: UTType { UTType(importedAs: "com.CompanyName.GreenPurple1") } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’24
Reply to Recommended or Typical UTI for Plain Text Editor App
This does indeed appear to be correct: Since public.plain-text is a system-defined UTType, and you want a standard extension (.txt), you don't need to declare either an imported or exported type identifier. You can just specify your document type as public.plain-text directly. After closing my Xcode project, I opened info.plist directly from my project via Finder. I then hovered over "Document types" and selected the tiny minus in a circle to delete that entry. I likewise deleted "Imported Type Identifiers". The only entry I had remaining was "App Uses Non-Exempt Encryption" which I have set to NO. I also removed this code: extension UTType { static var exampleText: UTType { UTType(importedAs: "com.example.plain-text") } } All seems to working well. Hopefully I didn't make a mess of things. Thanks again Polyphonic.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’24