Recently I saw an example where someone removed the @UIApplication tag from AppDelegate.swift and created a main.swift. This didn‘t work for me and I also don‘t see the idea behind it.
Is there an overview of the structure of a Swift app in Xcode somewhere?
This was answered in this old thread
https://forums.developer.apple.com/thread/49061
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.This will provide mor details
h ttps://medium.com/@Dougly/breaking-down-the-appdelegate-swift-3-258e48f907d6
Edited
used this as main.swift
import UIKit
UIApplicationMain(
CommandLine.argc,
CommandLine.unsafeArgv,
nil,
NSStringFromClass(AppDelegate.self)
)