Prevent NSTextAttachment from being selected

I am making a notes app similar to the iOS notes app. I am currently able to create checkboxes as NSTextAttachments and insert them into the NSAttributedString. However, like the iOS notes app, I want to prevent the user from being able to select the checkbox in the selectedTextRange or selectedRange. I am currently getting the selected text and the checkbox, instead of the text only being selected. Any help would be appreciated!
Prevent NSTextAttachment from being selected
 
 
Q