 
     fileprivate func detectAttachmentRemoved(in range:NSRange) {
         textStore.enumerateAttachmentsOfType(TextAttachment.self, range: range) { (attachment, range, stop) in
-            self.attachmentsDelegate?.storage(self, deletedAttachmentWithID: attachment.identifier)
+            self.attachmentsDelegate.storage(self, deletedAttachmentWithID: attachment.identifier)
         }
     }
 


    // MARK: - Attachments

    var attachmentsDelegate: TextStorageAttachmentsDelegate?

    open func TextAttachments() -> [TextAttachment] {
        let range = NSMakeRange(0, length)

    /// - Returns: the preprocessed string.
    ///
    fileprivate func preprocessAttachmentsForInsertion(_ attributedString: NSAttributedString) -> NSAttributedString {
        assert(attachmentsDelegate != nil)

        let fullRange = NSRange(location: 0, length: attributedString.length)
        let finalString = NSMutableAttributedString(attributedString: attributedString)
        
        attributedString.enumerateAttribute(NSAttachmentAttributeName, in: fullRange, options: []) { (object, range, stop) in
            guard let object = object, !(object is LineAttachment) else {
                return
            }

