         
     }
     
-    func sheetComposerConstraints () -> [AnyObject]{
-        let views: NSMutableDictionary = NSMutableDictionary()
-        views.setValue(sheetView, forKey: "sheet")
-        views.setValue(self.topLayoutGuide, forKey: "topLayoutGuide")
-        let horizontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("H:|-30-[sheet]-30-|", options: nil, metrics: nil, views: views as [NSObject : AnyObject])
-        let verticalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("V:|[topLayoutGuide]-\(topMargin)-[sheet]", options: nil, metrics: nil, views: views as [NSObject : AnyObject])
+    func sheetComposerConstraints () -> [NSLayoutConstraint]{
+        let viewBindings = ["topLayoutGuide": self.topLayoutGuide, "sheet": sheetView]
+        let horizontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("H:|-30-[sheet]-30-|", options: NSLayoutFormatOptions.AlignAllBaseline, metrics: nil, views: viewBindings as! [String : AnyObject])
+        let verticalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("V:|[topLayoutGuide]-\(topMargin)-[sheet]", options: NSLayoutFormatOptions.AlignAllBaseline, metrics: nil, views: viewBindings as! [String : AnyObject])
         let heightConstraint = NSLayoutConstraint(item: sheetView, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: sheetView, attribute: NSLayoutAttribute.Width, multiplier: 0.6, constant: 0)
         return  verticalConstraints + horizontalConstraints + [heightConstraint]
     }
     
-    func sheetComposerTitleConstraints () -> [AnyObject] {
-        let views: NSMutableDictionary = NSMutableDictionary()
-        views.setValue(sheetView, forKey: "sheet")
-        views.setValue(cancelButton, forKey: "cancelButton")
-        views.setValue(nextButton, forKey: "nextButton")
-        views.setValue(sheetTitle, forKey: "sheetTitle")
-        
-        let horizontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("H:|-10-[cancelButton]->=0-[sheetTitle]->=0-[nextButton]-10-|", options: nil, metrics: nil, views: views as [NSObject : AnyObject])
+    func sheetComposerTitleConstraints () -> [NSLayoutConstraint] {
+        let viewBindings = [
+            "sheet": sheetView,
+            "cancelButton": cancelButton,
+            "nextButton": nextButton,
+            "sheetTitle": sheetTitle
+        ]
+        
+        let horizontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("H:|-10-[cancelButton]->=0-[sheetTitle]->=0-[nextButton]-10-|", options: NSLayoutFormatOptions.AlignAllBaseline, metrics: nil, views: viewBindings)
         let sheetTitleCenterXConstraint = NSLayoutConstraint(item: sheetTitle, attribute: NSLayoutAttribute.CenterX, relatedBy: NSLayoutRelation.Equal, toItem: sheetView, attribute: NSLayoutAttribute.CenterX, multiplier: 1, constant: 0)
         sheetTitleCenterXConstraint.priority = 1000
-        let sheetTitleTopConstraints = NSLayoutConstraint.constraintsWithVisualFormat("V:|-15-[sheetTitle]", options: nil, metrics: nil, views: views as [NSObject : AnyObject])
+        let sheetTitleTopConstraints = NSLayoutConstraint.constraintsWithVisualFormat("V:|-15-[sheetTitle]", options: NSLayoutFormatOptions.AlignAllBaseline, metrics: nil, views: viewBindings)
         let cancelTitleTopConstraint = NSLayoutConstraint(item: cancelButton, attribute: NSLayoutAttribute.CenterY, relatedBy: NSLayoutRelation.Equal, toItem: sheetTitle, attribute: NSLayoutAttribute.CenterY, multiplier: 1, constant: 0)
         let nextTitleTopConstraint = NSLayoutConstraint(item: nextButton, attribute: NSLayoutAttribute.CenterY, relatedBy: NSLayoutRelation.Equal, toItem: sheetTitle, attribute: NSLayoutAttribute.CenterY, multiplier: 1, constant: 0)
         
         return horizontalConstraints + sheetTitleTopConstraints + [sheetTitleCenterXConstraint, cancelTitleTopConstraint, nextTitleTopConstraint]
     }
     
-    func headerLineConstraints () -> [AnyObject] {
-        let views: NSMutableDictionary = NSMutableDictionary()
-        views.setValue(headerLine, forKey: "headerLine")
-        views.setValue(sheetTitle, forKey: "sheetTitle")
-        
-        let horizontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("H:|-0-[headerLine]-0-|", options: nil, metrics: nil, views: views as [NSObject : AnyObject])
+    func headerLineConstraints () -> [NSLayoutConstraint] {
+        let viewBindings = ["headerLine": headerLine, "sheetTitle": sheetTitle]
+        
+        let horizontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("H:|-0-[headerLine]-0-|", options: NSLayoutFormatOptions.AlignAllBaseline, metrics: nil, views: viewBindings)
         let heightConstraint = NSLayoutConstraint(item: headerLine, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1, constant: 1)
-        let topConstraints = NSLayoutConstraint.constraintsWithVisualFormat("V:[sheetTitle]-15-[headerLine]", options: nil, metrics: nil, views: views as [NSObject : AnyObject])
+        let topConstraints = NSLayoutConstraint.constraintsWithVisualFormat("V:[sheetTitle]-15-[headerLine]", options: NSLayoutFormatOptions.AlignAllBaseline, metrics: nil, views: viewBindings)
         
         return horizontalConstraints + topConstraints + [heightConstraint]
     }
     
-    func charactersLabelConstraints () -> [AnyObject] {
-        let views: NSMutableDictionary = NSMutableDictionary()
-        views.setValue(charactersLabel, forKey: "charactersLabel")
-        
-        let horizontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("H:[charactersLabel]-10-|", options: nil, metrics: nil, views: views as [NSObject : AnyObject])
-        let verticalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("V:[charactersLabel]-10-|", options: nil, metrics: nil, views: views as [NSObject : AnyObject])
+    func charactersLabelConstraints () -> [NSLayoutConstraint] {
+        let viewBindings = ["charactersLabel": charactersLabel]
+        
+        let horizontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("H:[charactersLabel]-10-|", options: NSLayoutFormatOptions.AlignAllBaseline, metrics: nil, views: viewBindings)
+        let verticalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("V:[charactersLabel]-10-|", options: NSLayoutFormatOptions.AlignAllBaseline, metrics: nil, views: viewBindings)
         
         return horizontalConstraints + verticalConstraints
     }
     
-    func textViewConstraints () -> [AnyObject] {
-        let views: NSMutableDictionary = NSMutableDictionary()
-        views.setValue(textView, forKey: "textView")
-        views.setValue(headerLine, forKey: "headerLine")
-        views.setValue(charactersLabel, forKey: "charactersLabel")
-        
-        let horizontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("H:|-8-[textView]-8-|", options: nil, metrics: nil, views: views as [NSObject : AnyObject])
-        let verticalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("V:[headerLine]-0-[textView]-0-[charactersLabel]", options: nil, metrics: nil, views: views as [NSObject : AnyObject])
+    func textViewConstraints () -> [NSLayoutConstraint] {
+        let viewBindings = ["headerLine": headerLine, "textView": textView, "charactersLabel": charactersLabel]
+        
+        let horizontalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("H:|-8-[textView]-8-|", options: NSLayoutFormatOptions.AlignAllBaseline, metrics: nil, views: viewBindings)
+        let verticalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("V:[headerLine]-0-[textView]-0-[charactersLabel]", options: NSLayoutFormatOptions.AlignAllBaseline, metrics: nil, views: viewBindings)
         
         return horizontalConstraints + verticalConstraints
     }

        self.view.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.6)
        
        sheetView.backgroundColor = UIColor.whiteColor()
        sheetView.setTranslatesAutoresizingMaskIntoConstraints(false)
        sheetView.layer.cornerRadius = 8
        self.view.addSubview(sheetView)
        self.view.addConstraints(sheetComposerConstraints())
        
        cancelButton.setTranslatesAutoresizingMaskIntoConstraints(false)
        nextButton.setTranslatesAutoresizingMaskIntoConstraints(false)
        sheetTitle.setTranslatesAutoresizingMaskIntoConstraints(false)
        headerLine.setTranslatesAutoresizingMaskIntoConstraints(false)
        
        cancelButton.setTitleColor(self.view.tintColor, forState: UIControlState.Normal)
        cancelButton.titleLabel!.font = UIFont.systemFontOfSize(15)

    public func textView(textView: UITextView, shouldChangeTextInRange range: NSRange, replacementText text: String) -> Bool {
        let string = textView.text as NSString
        let newText = string.stringByReplacingCharactersInRange(range, withString: text)
        numberOfChars = newText.lengthOfBytesUsingEncoding(NSUTF8StringEncoding)
        return true
    }
    
