Objective-C or Swift?


(Aleksandra Bessalitskykh) #1

This post was flagged by the community and is temporarily hidden.


(Peter N Lewis) #2

This is clearly untrue. Objective-C has full compatibility with both C and C++, meaning you can mix C, C++ and Objective-C together without jumping through hoops. In fact, Objective-C++, with ARC, is an amazing combination, allowing C++ containers to hold Objective-C objects with ease.

Swift has basically no reasonable interoperation with C++ at this stage, and until it does it will be significantly harder to access C++ resources which abound. This alone is reason enough for me not to consider moving to Swift at this stage for any projects I am working on.

Swift may have lots of advantages, but it is not without its disadvantages as well.


(Mark Alldritt) #3

As a moderator, I’m concerned about this topic. The original post reads like a declaration rather than a question. I’ll leave it in place, but if things get out of hand I’ll delete this topic.

My experience with Swift has been both delightful and maddening. It has strengths and weaknesses like everything. Objective-C is mature, stable and just plain works. Peter’s comments re C++ are totally correct - I have vast amounts of C++ code in Script Debugger and the interaction with Objective-C is painless. However, its pretty clear that Apple wants the future to be Swift, but we are very definitely not there yet.

From the perspective of someone developing apps with AppleScript, I think its a wash. If Swift does what you need (i.e. has the API coverage you require), then go with it. Just be ready to have to deal with API “upgrades” with each major Xcode release (something that’s very uncommon with Objective-C).

Note that calling Swift from AppleScript is a non-starter at this stage. The ASObjC bridge wants to talk to Objective-C objects (i.e. things that inherit from NSObject and follow the Objective-C calling semantics).


(Christopher Stone) #4

Looks like Forum-SPAM to me.

@Bessalitskykh – Joined Nov 1, '18 Read 7m (6m recently)

One other completely inconsequential post.

-Chris