If Chime is built in release, the call to textDocuments.remove will be elided, as it is only used in the context of the assert call, and those are removed when doing a release build. As a result, you wouldn’t be able to successfully remove documents from projects. You would need to do this to make it work:
case let doc as TextDocument:
let removed: Bool = textDocuments.remove(doc) != nil
assert(removed)
While reading through your code I noticed the following:
https://github.com/ChimeHQ/Chime/blob/72e6297f6971a2dd235701016390267584fe60e5/Edit/Modules/Document/Models/Project.swift#L72-L73
If Chime is built in release, the call to
textDocuments.remove
will be elided, as it is only used in the context of the assert call, and those are removed when doing a release build. As a result, you wouldn’t be able to successfully remove documents from projects. You would need to do this to make it work: