Search code examples
swiftmacosmac-app-store

What are the pros and cons of using Swift for a Mac app?


I'm starting development of a new app, with no existing codebase to reuse. I'm very comfortable with Objective-C, but wanted to build the app in Swift, given that that's the future. But before that, I have a few questions:

Does the Mac App Store accept apps written in Swift?

Swift 3 isn't binary-compatible, so does that mean that the next version of macOS might break my app? Might I end up with a situation where I'll have to maintain two binaries for different versions of macOS?

Are all the Xcode debugging tools available for Objective-C also available for Swift?

Are there any other factors that relevant to this decision?


Solution

  • I don't see any restriction regarding Swift apps. They are accepted in the Mac App Store and whatever version of Swift you use, they'll be compatible with recent and future macOS versions. And the debugging tools work for Swift as well.

    Having said that, there are advantages and disadvantages:

    Advantages:

    • Modern language, superior to Objective-C
    • Full commitment by Apple
    • Can easily be mixed with Objective-C (e.g. with 3rd party libraries)

    Disadvantages:

    • Bigger app as all apps need to be bundled with Swift Runtime libraries.
    • It's not possible yet to create binary libraries in Swift. They have to be distributed in source code.
    • Refactoring in XCode only works for Objective-C.
    • The language is still evolving. Even though XCode helps to upgrade if the language changes, there's still manual work and retesting involved.