title: How to convert java code in swift?
body: <p>Here i have java code is looks like below:</p>
  
  <pre><code>this.mNetworkConnectionManager = new NetworkConnectionManager(new NetworkConnectionManager.OnNetworkListener() {
  
              @Override
              public void onNetworkPacketSent(String packet) {
                  BASPacket bp = new BASPacket(packet);
                  bp.setTimestampedPacket(timestampPacket(packet, "sent"));
  
                  mOnBASMessageListener.onBASMessageSent(bp);
              }
  
  
          });
  </code></pre>
  
  <p>I try to convert these code in swift like below:</p>
  
  <pre><code>self.mNetworkConnectionManager = NetworkConnectionManager(l: { NetworkConnectionManager.OnNetworkListener() 
              func onNetworkPacketSent(packet : String)
              {
                  var bp : BASPacket = BASPacket(packet: packet)
                  bp.setTimestampedPacket(timestampPacket(packet, sentrec: "sent"));
  
                  mOnBASMessageListener.onBASMessageSent(bp);
              }
          }())
  </code></pre>
  
  <p>But getting Compile error."Command failed due to signal: Segmentation fault: 11"</p>
  
  <p>Also i have NetworkManager class like below in swift:</p>
  
  <pre><code>public class NetworkConnectionManager
  {
      var mOnNetworkListener:OnNetworkListener = OnNetworkListener()
  
       init(l : OnNetworkListener)
      {
          self.mOnNetworkListener = l
  
      }
      class OnNetworkListener
      {
  
      }
  }
  </code></pre>