 import Foundation
 import UIKit
 
+/**
+A `Stylesheet` is a container for a selection of styles loaded from a plist.
+*/
+
 public class Stylesheet{
     
     public var styles: [String:Style]

    
    override public func prepareForInterfaceBuilder() {
        
        // We need to fish around directories to create subsitute for the main bundle when using Interface Builder live rendering
        let processInfo = NSProcessInfo.processInfo()
        let environment = processInfo.environment as! [String:String]
        let projectSourceDirectories : String = environment["IB_PROJECT_SOURCE_DIRECTORIES"]!
        let directories = projectSourceDirectories.componentsSeparatedByString(":")

        var path = directories[0] as String
        
        // Remove pods from the path components (assuming we are in a cocoapods environment)

            path=path.stringByDeletingLastPathComponent
        }
        
        // Create and a bundle based on the project path
        return NSBundle(path: path)
        
    }
}
