title: Set Action Listener Programmatically in Swift
body: <p>I saw some example codes that assign the same OnClick event to all the buttons  in Android  (even if they perform completely different action) . How can do it with Swift</p>
  
  <p>Android Example:</p>
  
  <pre><code>@Override 
  public void onCreate(Bundle savedInstanceState) {
          button1.setOnClickListener(onClickListener);
          button2.setOnClickListener(onClickListener);
          button3.setOnClickListener(onClickListener);
  } 
  
  private OnClickListener onClickListener = new OnClickListener() {
       @Override 
       public void onClick(View v) {
           switch(v.getId()){
               case R.id.button1:
                    //DO something 
               break; 
               case R.id.button2:
                    //DO something 
               break; 
               case R.id.button3:
                    //DO something 
               break; 
           } 
  
     } 
  }; 
  </code></pre>
  
  <p>Note: I don't want create the button programatically. </p>