1 Reply
      Latest reply on Jun 20, 2016 2:38 AM by eskimo
      ShinehahGnolaum Level 1 Level 1 (0 points)

        In AppDelegate.swift file, I see a line of code at the very top, just below an import keyword.  It says "@UIApplicationMain".  What does that line of code do?  What does the"@" at the beginning mean?

        • Re: @UIApplicationMain AppDelegate.swift
          eskimo Apple Staff Apple Staff (11,265 points)

          In AppDelegate.swift file, I see a line of code at the very top, just below an import keyword.  It says "@UIApplicationMain".  What does that line of code do?

          It indicates that this class should be treated as the app delegate for a UIKit based application.  If you leave it out then you have to add a main.swift file that calls the UIApplicationMain function.  This is unnecessary boilerplate, so Swift has a nice shortcut to avoid it.

          What does the"@" at the beginning mean?

          The @ character introduces a Swift attribute, which modifies the following class declaration.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"