title: protocol only can be use as generic
body: <p>I'm trying to use protocol in my class here is the code </p>
  
  <pre><code>public protocol Channel {
  
   typealias CallBackType
   func onResponse(responseDic: NSDictionary)
   func onRequest(responseDic: NSDictionary)
   func onBroadcast(responseDic: NSDictionary)
   func request(var messageDic: [String:String]) -&gt; Promise&lt;Any&gt;
   func broadcast(var messageDic:[String:AnyObject])
   func listen(messageDic:[String: AnyObject], callback:CallBackType)
  }
  </code></pre>
  
  <p>Then I have other class where I create the class that use my protocol</p>
  
  <pre><code>public  class SocketManager {
    var systemChannel:SystemChannel?
  public var socket = SocketIOClient(socketURL: hostUrl, options: ["log":      false,
      "reconnects": true,
      "reconnectAttempts": 5,
      "reconnectWait": 5,
      "connectParams": ["token":tokenSDK]])
  
  public func start_socket() -&gt; Promise&lt;Bool&gt; {
   systemChannel = SystemChannel(socket: self.socket)
  }
  
  public func getChannel(typeChannel:SOCKET_CHANNELS) -&gt; Channel{
      switch typeChannel{
          case .SYSTEM:
              return  systemChannel!
          default:
              return systemChannel!
      }
  }
  }
  </code></pre>
  
  <p>Here is the SystemChannel class</p>
  
  <pre><code>public  class SystemChannel: Channel {
   public typealias CallBackType = [String: AnyObject] -&gt; Void
  }
  </code></pre>
  
  <p>But I get compile error on the getChannel method  <code>Protocol 'Channel' can only be used as a generic constraint because it has Self or associated type requirements</code></p>