Deprecate @UIApplicationMain and @NSApplicationMain

Hello Swift Community,

I wanted to kick off a discussion about the deprecation and eventual removal of the framework-specific entrypoint attributes @UIApplicationMain and @NSApplicationMain. To offer a brief background, these attributes were introduced with Swift 1.1 to make it far simpler to write an app entirely in Swift. Before that, the main entrypoint was either contained in a main.swift or an Objective-C .m file that called UIApplicationMain or NSApplicationMain as appropriate. Even for apps written entirely in Swift, I'm sure some of us can recall having to manually call these entrypoints with the (then) CommandLine type's data and how awkward that was.

With the advent of SE-0281 and the enthusiastic adoption of type-based entrypoints by SwiftUI, AppKit, and UIKit, I feel that it's time to begin a discussion about removing the hard-coded framework-specific attributes from the language.

A draft copy of the proposal text can be found in this gist. The implementation is mostly noise in tests since this proposal is just about a diagnostic, but it can be found here

45 Likes

I am all for removing these and reducing the potential confusion between these attributes.

1 Like

This seems like a “no-brainer” to me. :+1:

1 Like

I was wondering when we can remove @GKInspectable , @IBInspectable and @IBOutlet stuff too.

Maybe there is a property wrapper solution for them. They should be part of the GameplayKit SDK and storyboard related SDK (UIKit or AppKit) instead of being part of Swift.

2 Likes

Those are a bit trickier because they imply @objc (possibly even @objc dynamic for the inspectable ones, I don’t remember offhand). But I agree that they do feel like they should be defined in libraries rather than built-in, if we had that capability.

5 Likes

Since this proposal is just sooo controversial, I'm committing it. Thanks everybody for the positive sentiments.

7 Likes