>> >> It's annoying but not dreadful to link C++ code into Cocoa via 
>> >> Objective-C.
>>  Pretty easy, I’d say; mostly you just rename your file from “.m” to “.mm” 
>> and then use C++ wherever you wish.

That part is easy, and at the beginning we were very optimistic.

The problem is, we already have an MVC architecture written in C++ / PowerPlant.
It has many business logic quirks.  We have to link the C++ controllers to 
Cocoa controllers, 
and each C++ view field to a Cocoa control (usually with subtly different 
behaviors).

Moving anything from Obj-C to C++ objects is easy, because the .mm file can 
contain both.

Moving back is hard, because C++ can't reference Obj-C classes. We use an 
intermediate C++ linker class with void pointers to Obj-C objects in the 
header.  
Then a .mm source file that talks with both.

What used to be controller -> field becomes Cocoa controller -> C++ controller 
->
C++ field -> linker -> Cocoa control.  The alternative is to rewrite all the 
business logic
in Cocoa, but that would require a year of testing to get it all right again.  
Then maintaining
two code bases from here on out.

>> I’d tentatively suggest that it’s likely that Swift will develop some means 
>> of 
interfacing more directly with C++ code in the future, which should make this 
easier rather than harder.

This link says that C++ support is now marked "out of scope" in Swift 3.0:
https://stackoverflow.com/questions/35229149/interacting-with-c-classes-from-swift
I didn't find any mention of future support being planned.

Casey McDermott
Turtle Creek Software 
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to