 public typealias XCTUIBridgeRemover = () -> Void;
 public typealias XCTUIBridgeCallback = () -> Void;
 
-let XCTUIBridgeNotification = "XCTUIBridgeNotification"
 let instance = XCTUIBridge()
 
 class XCTUIBridgeCallbackContainer {

    
    static private func registerForDarwinNotification(identifier: String) {
        let callback: @convention(block) (CFNotificationCenter!, UnsafeMutablePointer<Void>, CFString!, UnsafePointer<Void>, CFDictionary!) -> Void = { (center, observer, name, object, userInfo) in
            if let name = name {
                NSNotificationCenter.defaultCenter().postNotificationName(XCTUIBridgeNotification, object: nil, userInfo: ["name":name])
            }
        }
        
        let imp: COpaquePointer = imp_implementationWithBlock(unsafeBitCast(callback, AnyObject.self))
        let notificationCallback = unsafeBitCast(imp, CFNotificationCallback.self)
        
        CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), unsafeAddressOf(self), notificationCallback, identifier, nil, .DeliverImmediately)
    }



public class XCTUIBridge {
    private var clientListeners = [String: NSMutableArray]();
    func notificationRecieved(name:String) {
        if let listeners = clientListeners[name] {
            for var i = 0; i < listeners.count; i++ {
                (listeners.objectAtIndex(i) as? XCTUIBridgeCallbackContainer)?.completion()
            }
        }
    }
    
