In the IBAction of the UIButton, to get the name (I think you mean the title ?):
@IBAction func buttonAction(_ sender: AnyObject) {
let name = (sender as! UIButton).currentTitle!
If you want to get the title for each state:
let name = (sender as! UIButton).title(for: UIControlState.highlighted) ?? "no name")
If no title defined for hilighted, you'll get a no name
The type :
let type = (sender as! UIButton).buttonType..rawValue
For the rawValue corresponds to the enum UIButtonType:
case custom 0
No button style.
case system 1
A system style button, such as those shown in navigation bars and toolbars.
case detailDisclosure 2
A detail disclosure button.
case infoLight 3
An information button that has a light background.
case infoDark 4
An information button that has a dark background.
case contactAdd 5
A contact add button.
case plain 6
A standard system button without a blurred background view.
There is another type : static var roundedRect: UIButtonType
A rounded-rectangle style button.