0

I am a currently learning Swift and I am facing an issue understanding the @ annotation that I have seen in some codes in Swift. For example: @IBAction.

What does it really mean?

JAL
  • 41,701
  • 23
  • 172
  • 300
AmineIng
  • 9
  • 3

1 Answers1

1

Attributes provide more information about a declaration or type. There are two kinds of attributes in Swift, those that apply to declarations and those that apply to types.

You specify an attribute by writing the @ symbol followed by the attribute’s name and any arguments that the attribute accepts:

@attribute name
@attribute name(attribute arguments)

Some declaration attributes accept arguments that specify more information about the attribute and how it applies to a particular declaration. These attribute arguments are enclosed in parentheses, and their format is defined by the attribute they belong to.

From Apple Documents, Attributes

JJJ
  • 32,902
  • 20
  • 89
  • 102
Vahid
  • 3,352
  • 2
  • 34
  • 42