                     return
                 }
 
-                let replacementAttachment = ImageAttachment(identifier: NSUUID.init().uuidString)
+                let replacementAttachment = ImageAttachment(identifier: NSUUID().uuidString)
                 replacementAttachment.delegate = self
                 replacementAttachment.image = image
 
-                let imageURL = attachmentsDelegate.storage(self, urlFor: replacementAttachment)
+                let imageURL = delegate.storage(self, urlFor: replacementAttachment)
                 replacementAttachment.updateURL(imageURL)
 
                 finalString.addAttribute(NSAttachmentAttributeName, value: replacementAttachment, range: range)

        return attachments
    }

    func range<T : NSTextAttachment>(for attachment: T) -> NSRange? {
        var range: NSRange?


    /// - Returns: the preprocessed string.
    ///
    fileprivate func preprocessAttachmentsForInsertion(_ attributedString: NSAttributedString) -> NSAttributedString {
        // Ref. #727:
        // If the delegate is not set, we *Explicitly* do not want to crash here.
        //
        guard let delegate = attachmentsDelegate else {
            return attributedString
        }

        let fullRange = NSRange(location: 0, length: attributedString.length)
        let finalString = NSMutableAttributedString(attributedString: attributedString)
