         }
     }
     
-    
-    private var _selectedBackgroundView: UIView?
+    /// The selectedBackgroundView will be placed above the background view and displayed on view selection.
     public var selectedBackgroundView:UIView? {
-        get {
-            return _selectedBackgroundView
-        }
-        set(selectedBackgroundView) {
-            _selectedBackgroundView?.removeFromSuperview()
-            _selectedBackgroundView = nil
-            _selectedBackgroundView = selectedBackgroundView!
-            _selectedBackgroundView!.hidden = true
-            
-            _selectedBackgroundView!.translatesAutoresizingMaskIntoConstraints = false
-            self.insertSubview(_selectedBackgroundView!, belowSubview: self.contentView)
-            
-            let views = ["sbV": _selectedBackgroundView!]
+        willSet {
+            self.selectedBackgroundView?.removeFromSuperview()
+            self.selectedBackgroundView = nil
+        }
+        didSet {
+            self.selectedBackgroundView!.hidden = true
+            
+            self.selectedBackgroundView!.translatesAutoresizingMaskIntoConstraints = false
+            self.insertSubview(self.selectedBackgroundView!, belowSubview: self.contentView)
+            
+            let views = ["sbV": self.selectedBackgroundView!]
             self.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[sbV]|",
                 options: NSLayoutFormatOptions.DirectionLeftToRight, metrics: nil, views: views))
             self.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|[sbV]|",
                 options: NSLayoutFormatOptions.DirectionLeftToRight, metrics: nil, views: views))
-            
-        }
-    }
+        }
+    }
+    
+    // MARK: - Init
     
     required public init?(coder aDecoder: NSCoder) {
         super.init(coder: aDecoder)

 `SwiftGridReusableView` is the primary reusable view used for headers and footers in the `SwiftGridView`
 */
public class SwiftGridReusableView: UICollectionReusableView {
    public var selected:Bool = false {
        didSet {
            self.selectedBackgroundView?.hidden = !selected
        }
    }
    public var highlighted:Bool = false{
        didSet {
            self.selectedBackgroundView?.hidden = !highlighted
        }
    }
    internal var delegate:SwiftGridReusableViewDelegate?
    internal var elementKind: String = ""
    internal var indexPath:NSIndexPath = NSIndexPath.init() // TODO: Is there a better way to handle this?
    
    public var contentView:UIView = UIView()
    
    private var _backgroundView: UIView?
    public var backgroundView:UIView? {
        get {
            return _backgroundView
        }
        set(backgroundView) {
            _backgroundView?.removeFromSuperview()
            _backgroundView = nil
            _backgroundView = backgroundView!
            
            _backgroundView!.translatesAutoresizingMaskIntoConstraints = false
            if(self.selectedBackgroundView != nil) { // TODO: Simplify this logic?
                self.insertSubview(_backgroundView!, belowSubview: self.selectedBackgroundView!)
            } else {
                self.insertSubview(_backgroundView!, belowSubview: self.contentView)
            }
            
            let views = ["bV": _backgroundView!]
            self.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[bV]|",
                options: NSLayoutFormatOptions.DirectionLeftToRight, metrics: nil, views: views))
            self.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|[bV]|",

import Foundation
import UIKit

// MARK: - SwiftGridReusableViewDelegate

/**
 The `SwiftGridReusableViewDelegate` is used for passing selection and highlighting events through to the data grid.
 */
public protocol SwiftGridReusableViewDelegate {
    /**
     Called when the reusable view is selected.
     
     - Parameter reusableView: The reusable view instance.
     - Parameter indexpath: The swift grid view index path of the passed reusable view.
     */
    func swiftGridReusableView(reusableView: SwiftGridReusableView, didSelectViewAtIndexPath indexPath: NSIndexPath)
    
    /**
     Called when the reusable view is deselected.
     
     - Parameter reusableView: The reusable view instance.
     - Parameter indexpath: The swift grid view index path of the passed reusable view.
     */
    func swiftGridReusableView(reusableView: SwiftGridReusableView, didDeselectViewAtIndexPath indexPath: NSIndexPath)
    
    /**
     Called when the reusable view is highlighted.
     
     - Parameter reusableView: The reusable view instance.
     - Parameter indexpath: The swift grid view index path of the passed reusable view.
     */
    func swiftGridReusableView(reusableView: SwiftGridReusableView, didHighlightViewAtIndexPath indexPath: NSIndexPath)
    
    /**
     Called when the reusable view is unhighlighted.
     
     - Parameter reusableView: The reusable view instance.
     - Parameter indexpath: The swift grid view index path of the passed reusable view.
     */
    func swiftGridReusableView(reusableView: SwiftGridReusableView, didUnhighlightViewAtIndexPath indexPath: NSIndexPath)
}

