C++ desktop development in Xcode 10

I am fairly new to development - mostly trying things out to see what I llike - and I have been drawn to C++ (yes I know it's a ***** for a newbie, I must really hate myself, .....).


I'm familiar with Xcode's Command Line Tool but I would like to experiment with other things, like desktop applications. However, I do not know enough about the console command line / console / Terminal to know if I can use this template on Xcode to develop a desktop program. I've looked this up online, but I can't really find anything that talks about this. The search results steer me in another direction.


Are there any good extensions that could help? (I'm trying to avoid any third party IDEs right now, until I can get a solid foundation.)

Replies

You'll want to elaborate on what you mean by "Desktop". I'm not entirely certain where you're headed, here. I think it's to the GUI, but you're also discussing command-line work, so...


If that's developing apps that display in the Terminal.app window and that use ANSI control sequences for character positioning and text-related handling, or if you're referring to the graphical display and to how apps such as Xcode.app itself and Finder.app and Mail.app and the rest displays its user interface.


Usual command-line tools either use cout or printf or equivalent and simple scrolling interfaces, or—for fancier displays—can use a character-positioning library such as ncurses. The command-line tools are comparatively simple displays, though there are more complex frameworks. These all involve sending control sequences (also called escape sequences) to perform character positioning. This is how top displays its data, for instance. It sends specific ANSI control sequences to position to the display, and to display simple graphics or reverse or bold or flashing text. If you want to learn about this (older) world, start at the VT100 web site. Most of the command line world is based off the Digital Equipment Corporation (DEC) VT100 terminal or emulation of that or later models, and the associated ANSI control sequences.


If you're now considering doing desktop apps, that is usually easiest using Xcode and Interface Builder, and using Objective-C or Objective-C++. Or using Storyboards and Playgrounds. This display is different from how command-line tools work and how the control flow works in command-line tools, in that the macOS system calls into and displays the interface you've created, and then the system then calls into the routines that you've tied to your buttons and UI constructs. (Yeah, technically, there's a runt main program source module that kicks all this off.)


You'll need to use Objective-C++ to work with the GUI, and either a whole lot of Objective-C++ code to manage and position and the rest, or Interface Builder to do all that. I'd suggest Interface Builder. But then if you're coming from the VT100 world, maybe you really want to write all of the positioning code and the rest yourself. While sometimes (rarely) necessary, it's still an error-prone slog to write your own display code. Interface Builder (and Storyboards) are just far faster. Storyboards work well for UI development, and are fairly new to Xcode.


There are videos and particularly books on using Xcode and Interface Builder, and Apple has some documentation on this topic. Apple offers videos too, but those drill in on specific areas and are definitely not introductory material. The most recent Apple Xcode Intro video I've found is probably a little stale. Though the Apple WWDC app is worth downloading, for an easy path into the videos.


I did this with the Xcode help, and particularly with books and with downloading and exploring existing projects. But there's no right way to learn how to use Xcode and Interface Builder.


Of all this, Swift Playgrounds on iOS are probably the closest to a learning tool for GUI development, but that's Swift and iPad not C++ and macOS.


As for apps you might want to aquire? Dash.app is handy. There's also TLDR pages, too.


For Xcode extensions, the sole extension I've been using is a source code formatter; the clang-format extension.


I don't have any references to any books, as the ones I used are now dated. Xcode moves fairly quickly for the book authors to keep up, unfortunately.

C++ is not going to provide much help for writing desktop apps. Apple's desktop support frameworks are all in Objective-C or C. There are Swift wrappers around then, but they are still Objective-C underneath.


If you really want to develop desktop apps, then Swift is the way to go. Ignore the "anybody can code" marketing for Swift. It is really one of the most complicated languages ever designed. If C++ appeals to you, then you should love Swift.


You can use C++ for other platforms or for non-desktop applications. But generally, any user interface framework for any platform is going to be implement in some funky language or process that is useless on any other platform.