Xcode 12 / iOS14 Widget "@main and must provide a main static function" error

For anyone looking to fix the AppDelegate issue when turning on Mac for an iOS14 project - please consult : iOS Xcode 12.0 Swift 5 'AppDelegate' is annotated with @main and must provide a main static function of type () -> Void or () throws -> Void

The fix is to change "@main" to "@UIApplicationMain"


You are using name Widget, there is already a protocol called Widget in SwiftUI framework.

You should use some other name but if you really want to, add module name at start like SwiftUI.Widget

@main
struct Widget: SwiftUI.Widget {
    private let kind: String = "Widget"

    public var body: some WidgetConfiguration {
        IntentConfiguration(kind: kind, intent: ConfigurationIntent.self, provider: Provider(), placeholder: PlaceholderView()) { entry in
            WidgetEntryView(entry: entry)
        }
        .configurationDisplayName("My Widget")
        .description("This is an example widget.")
    }
}