Viewcontroller.swift//button//import UIKit class Viewcontroller:uiviewcontroller {override Func Viewdidloa D () {super.viewdidload ()//❗️swift advocates://Replace ' Selector ("Buttontap") ' With ' #selector (VIEWC ONTROLLER.BUTTONTAP) '//button click on no parameter Let button = UIButton (Frame:cgrect (x:0, y:0, width:50, Height: ) Button.backgroundcolor = Uicolor.yellow button.addtarget (self, Action: #selector (Viewcontroller.butt ONTAP), For:UIControlEvents.touchUpInside)//button1: Click on the parameter Let button1 = UIButton (Frame:cgrect (x:100, y : 0, Width:50, height:30)) Button1.backgroundcolor = Uicolor.yellow button1.addtarget (self, Action: #sel Ector (BUTTONTAP1 (button:)), For:UIControlEvents.touchUpInside) Self.view.addSubview (button) self.view.ad Dsubview (button1)}//selector is actually the concept of Objective-c runtime @objc func Buttontap () {print ("Buttontap" )} @objc FuncButtonTap1 (Button:uibutton) {print ("Buttontap parameter")}}