Post

Replies

Boosts

Views

Activity

Reply to Mac swift Xib based doc app deletes a doc when I make changes and then save it.
here is what caused that issue: when you save the file for the very first time, your identifier is exactly the way you type it in in the text field. here's mine: com.BkTools.blockingDoc when you save changes to a file, the identifier is lowercased: com.bktools.blockingdoc I actually test for my type identifier, because I will probably need to have more than one. So I uses a Switch. and the list of options needs to be exhaustive, so I have a Default: option that returns an empty Data() But that should never get called. under any circumstances. I have a closed loop here. I am saving MY file type, I Am opening MY file type. I have written down MY identifier, so I can Expect MY file identifier. except. I can't. Somebody transforms my identifier before I get it. which is a cardinal sin. WORSE, they transform my identifier, only SOME of the time. which in my book is far far worse a cardinal sin. the workaround... when I inevitably run into this problem again and there's no documentation then either: is to either use all lowercase in the identifier, or to use the convenience method : lowercase() on the string in the switch and just check for the lower case version. half a day looking for that little gem.
Topic: UI Frameworks SubTopic: AppKit Tags:
Nov ’23