I have an existing framework for a command line application built from C++, I want to use it as the model layer for a particular button in a Cocoa application. The GUI for the application is in Cocoa and already constructed, however at the moment any buttons that don't interact exclusively with the GUI do nothing as a result. I have only been using Swift for about four days and already find it far too convoluted and poorly designed. Likewise Objective-C makes very little sense to me.
The majority of programs I have written in C++ rely entirely on if
/and
/else
checks and reading/writing to files via fstream
. This has worked very well for me, I have never really needed more to achieve what I want each program to do, and I have been able to make fairly complex jobs entirely automated using a simple goto
statement (yes I know most people find them to be bad practice, but I have had very few issues with them and they get the job done). However to achieve the same results in Obj-C or Swift seems to unconditionally require a gross amount of excess code. One of my programs quickly goes from 56 lines for the entire source in C++ to well over 150 lines for a 1/5th of the total source when rewritting it in Swift, and I couldn't even get it to work in Obj-C.
All I need the GUI to do is run the automated C++ executable in the background, and if possible (without too much excess code) display console output in a textview when a button is clicked. That's all it needs to do, so how would I go about linking push-button Test
in Cocoa GUI Test.app
to function main()
in C++ source file test.cpp
?