Be careful when setting the class name when creating a document-based app in Swift

A note that I was addicted to the fact that when I tried to add a document-based element to what I originally made as a single app, it just didn't recognize the file. In the document-based application, there is a place to set the Document Type as an item of Info.plist. In addition to declaring the UTI and Role of the file at this location, set the Cocoa class corresponding to Class when linking with the Document class. In the case of Objective-C, there is no problem if you write the class name as it is, but when configuring a module with Swift, the name of the Document class is officially written as follows.

Info.plist


$(PRODUCT_MODULE_NAME).DocumentClass

If this is not set correctly, it will not be recognized even if you pass the file by open dialog or dragging the Dock.

It only tells me that I can't open the error message, and I'm addicted to it because there's no explanation as to why it can't be opened. Actually, there is a description in Apple's sample, but there is no direct description in NSDocument, and there are many old documents around the document base, so I think that it will be overlooked if you carelessly feel like Objective-C. Or rather, I was worried about this for an hour.

Recommended Posts

Be careful when setting the class name when creating a document-based app in Swift
When you get lost in the class name
Be absolutely careful when putting the result of and / or in a variable!
Swift: A trap when setting multiple initial elements in an array
Be careful when omitting return in Ruby
When the bean class name is duplicated
In file'./docker-compose.yml', the service name True must be a quoted string, i.e.'True'.
Creating a Servlet in the Liberty environment
Creating a matrix class in Java Part 1
How to reference a column when overriding the column name method in ActiveRecord
Call a method of the parent class by explicitly specifying the name in Ruby
Isn't there a name collision when enum has the same name in the switch statement?
Be careful with requests and responses when using the Serverless Framework in Java
Add .gitignore when creating a project in Xcode
Escape processing when creating a URL in Ruby
How to add sound in the app (swift)
Provisional memo when the name of the method parameter of the Java class cannot be obtained by reflection in the Eclipse plug-in project.
How to get the class name of the argument of LoggerFactory.getLogger when using SLF4J in Java
Write a class that can be ordered in Java
Get the name of the test case in the JUnit test class
[Ruby / Rails] Set a unique (unique) value in the class
[Swift] Use UserDefaults to save data in the app
[Swift] Setting the behavior when the Share button is pressed
[Technical memo] Things to be careful of from an engineer's point of view when creating a view
[Rails Tutorial Chapter 2] What to do when you make a mistake in the column name
What you need to do to open a file from the menu in the document-Based App macOS app
wsimport error handling (A class / interface with the same name "xxx" is already in use)
How to get the class name / method name running in Java
I want to give a class name to the select attribute
[Rails] Where to be careful in the description of validation
[Swift] When you want to know if the number of characters in a String matches a certain number ...