Newbie Question About Writing Applications For Desktop/Laptop


Charles Phillips
 

All -

I have written "command line" applications for a couple of years - actually I edit my code and run it from within XCode. It is not elegant but it works great; they are in C and C++ so far. They take orbital information for satellites and find other parameters like apogee and perigee. I read from input files and write out various files as needed. So I actually do not run the applications from the command line, doing that would be an extra couple of steps. 

I have looked around for books and support forums of course, they are not easy to find (anything that talk about Macs).

Now I'd like to make the applications easier to use, it would be handy to have a stand alone application. But I want to run them on Macs and they do not lend themselves to use on a iPhone at all - I need a bigger screen. I was able to look at some books in bookstores that talked about programming for Macs (before this stay at home stuff started) but they all talked about Swift and none seemed to have an example of one that was going to run on a desktop/laptop. So I got a book from Amazon "Objective-C for Absolute Beginners" because it sounded like it might have some desktop examples. But it also only has examples for iPhones! I went with Objective-C because I would like to find some examples designed for use on a bigger screen. 

Fortunately most of my C code compiles with Objective-C, a printf works for an NSLog in my needs. I can write a lot of this in Objective-C but my C code compiles just fine so I am not spending time to rewrite it. 

On myt MacBook Pro I have XCode 9, it gives me ViewController.h and ViewController.m - those are the files that I think I need to work from. I start a project with XCode (version 11) and tell it that I am writing for MacOS and using Objective-C, it gives me AppDelegate.h etc. I wonder if those are specific to iPhones?

This is so wrong but I was writing the code that should be in the .h and .m files, but put it in main.m - so I didn't need to #import it. Still, this is not the school solution so I am fixing that. So main.m has @interface - @end, etc. 

Finally, my questions: Is there a support forum that will not cost me $99 per year? Yes I am starting off cheap. Is there a book out there that has desktop examples? I bought a book Objective-C for Absolute Beginners, hoping that it would have examples for a desktop - it does not! Grr. I decided to start with Objective-C hoping that I could find examples of code that ran on desktops but it seems hard to find. 

I use XCode 9 and 11.3.1 but I am pretty sure that I can just write the code by hand and then figure out where it should really go later. 

I rewritten this note several times, just writing it has helped me answer some questions. What I am trying to learn is far more "Interface Builder" and its current incarnation more than coding or how to use XCode.

Thanks. Please don't roast me, what I have works but it is not "right" yet. An example of what my code does:

https://www.thespacereview.com/article/3820/1

Charles
Houston, Texas


Jonathan Prescott
 

1 - You should sign up for a free Apple developer account.  You don’t have to pay the $99 to get most of the help you need.  developer.apple.com has a lot of documentation, and some of the archived documentation includes introductions to MacOS programming.

2 - Search for “MacOS Programming” or “MacOSX programming” or “OS X programming”, not just Objective-C.  There are several books on the Apple book store about building MacOS programs, as well as resources on the Internet for MacOS application development, as well as third-party books.  Objective-C is a language, not the application environment.

3 - I build similar software using combinations of Swift, C, C++, Objective-C, Objective-C++, and Fortran.  Fortran is a little tricky, but I am starting to get it to work.  The only real glitch I have is that Swift <-> C++ needs a shim layer based on either C or Objective-C/Objective-C++ (I use Objective-C++ most of the time because of the easy interacting with C++ objects and routines, but C/Objective-C are useful at times).

4 - Objective-C/Objective-C++ are super-sets of the C/C++.  If it compiles in C/C++, it will compile in Objective-C/Objective-C++, but, not vice versa.

5 - You can tell Xcode to compile a file using the Objective-C++ compiler by giving it a file extension of “.mm”.

6 - A minimal MacOS desktop application consists of main.m, AppDelegate.h, ViewController.h, and ViewController.m files.  You should have gotten an AppDelegate.h even in Xcode 9, if you are building a desktop application.  If you are building a command line application, all you get is a main.m.

7 - There is lot of documentation on the AppKit architecture you get to within Xcode, on the developer.apple.com site, the Internet, and in MacOS programming books. The Xcode Help also has a pretty good starter guide for Interface Builder.

8 - A Mac Desktop application is not like a command line application.  You have to worry about timer events, user events, run loops to manipulate the graphical user interface.  As an aside, you can archive your command line application in Xcode, then export the archive which will get you a copy of the command line executable you can run on the command line without having to use Xcode to run it.

Jonathan

On May 16, 2020, at 1:04 PM, Charles Phillips <phillipstriples@...> wrote:

All -

I have written "command line" applications for a couple of years - actually I edit my code and run it from within XCode. It is not elegant but it works great; they are in C and C++ so far. They take orbital information for satellites and find other parameters like apogee and perigee. I read from input files and write out various files as needed. So I actually do not run the applications from the command line, doing that would be an extra couple of steps. 

I have looked around for books and support forums of course, they are not easy to find (anything that talk about Macs).

Now I'd like to make the applications easier to use, it would be handy to have a stand alone application. But I want to run them on Macs and they do not lend themselves to use on a iPhone at all - I need a bigger screen. I was able to look at some books in bookstores that talked about programming for Macs (before this stay at home stuff started) but they all talked about Swift and none seemed to have an example of one that was going to run on a desktop/laptop. So I got a book from Amazon "Objective-C for Absolute Beginners" because it sounded like it might have some desktop examples. But it also only has examples for iPhones! I went with Objective-C because I would like to find some examples designed for use on a bigger screen. 

Fortunately most of my C code compiles with Objective-C, a printf works for an NSLog in my needs. I can write a lot of this in Objective-C but my C code compiles just fine so I am not spending time to rewrite it. 

On myt MacBook Pro I have XCode 9, it gives me ViewController.h and ViewController.m - those are the files that I think I need to work from. I start a project with XCode (version 11) and tell it that I am writing for MacOS and using Objective-C, it gives me AppDelegate.h etc. I wonder if those are specific to iPhones?

This is so wrong but I was writing the code that should be in the .h and .m files, but put it in main.m - so I didn't need to #import it. Still, this is not the school solution so I am fixing that. So main.m has @interface - @end, etc. 

Finally, my questions: Is there a support forum that will not cost me $99 per year? Yes I am starting off cheap. Is there a book out there that has desktop examples? I bought a book Objective-C for Absolute Beginners, hoping that it would have examples for a desktop - it does not! Grr. I decided to start with Objective-C hoping that I could find examples of code that ran on desktops but it seems hard to find. 

I use XCode 9 and 11.3.1 but I am pretty sure that I can just write the code by hand and then figure out where it should really go later. 

I rewritten this note several times, just writing it has helped me answer some questions. What I am trying to learn is far more "Interface Builder" and its current incarnation more than coding or how to use XCode.

Thanks. Please don't roast me, what I have works but it is not "right" yet. An example of what my code does:

https://www.thespacereview.com/article/3820/1

Charles
Houston, Texas


Charles Phillips
 

1 - You should sign up for a free Apple developer account.  You don’t have to pay the $99 to get most of the help you need.  developer.apple.com has a lot of documentation, and some of the archived documentation includes introductions to MacOS programming.
Let me look at that. 

2 - Search for “MacOS Programming” or “MacOSX programming” or “OS X programming”, not just Objective-C.  There are several books on the Apple book store about building MacOS programs, as well as resources on the Internet for MacOS application development, as well as third-party books.  Objective-C is a language, not the application environment.
Fortunately I can get all sorts of code to run, the interface is the part that I have not yet figured out. 
3 - I build similar software using combinations of Swift, C, C++, Objective-C, Objective-C++, and Fortran.  Fortran is a little tricky, but I am starting to get it to work.  The only real glitch I have is that Swift <-> C++ needs a shim layer based on either C or Objective-C/Objective-C++ (I use Objective-C++ most of the time because of the easy interacting with C++ objects and routines, but C/Objective-C are useful at times).
I programmed in FORTRAN - a long time ago. With C, I can find libraries like sorting, etc. I do a lot of sorting. C++ also has libraries and I am sure that Objective-C does, I just gotta find them.
4 - Objective-C/Objective-C++ are super-sets of the C/C++.  If it compiles in C/C++, it will compile in Objective-C/Objective-C++, but, not vice versa.
 
5 - You can tell Xcode to compile a file using the Objective-C++ compiler by giving it a file extension of “.mm”.
Hmmm. That might come in handy sometime. 
6 - A minimal MacOS desktop application consists of main.m, AppDelegate.h, ViewController.h, and ViewController.m files.  You should have gotten an AppDelegate.h even in Xcode 9, if you are building a desktop application.  If you are building a command line application, all you get is a main.m.
 
7 - There is lot of documentation on the AppKit architecture you get to within Xcode, on the developer.apple.com site, the Internet, and in MacOS programming books. The Xcode Help also has a pretty good starter guide for Interface Builder.
 
8 - A Mac Desktop application is not like a command line application.  You have to worry about timer events, user events, run loops to manipulate the graphical user interface.  As an aside, you can archive your command line application in Xcode, then export the archive which will get you a copy of the command line executable you can run on the command line without having to use Xcode to run it.
Right now I build files of orbits and run my applications to find various parameters for each - like take a satellite and find perigee over time. So a command line type application works for me, the application runs on the target file and outputs several results files. But I hope that if I had a desktop application I could give it the satellite number and the application would parse a big file of various satellites to get the ones that I needed. 
Charles


Jonathan Prescott
 


See below

On May 16, 2020, at 6:29 PM, Charles Phillips <phillipstriples@...> wrote:

1 - You should sign up for a free Apple developer account.  You don’t have to pay the $99 to get most of the help you need.  developer.apple.com has a lot of documentation, and some of the archived documentation includes introductions to MacOS programming.
Let me look at that. 

2 - Search for “MacOS Programming” or “MacOSX programming” or “OS X programming”, not just Objective-C.  There are several books on the Apple book store about building MacOS programs, as well as resources on the Internet for MacOS application development, as well as third-party books.  Objective-C is a language, not the application environment.
Fortunately I can get all sorts of code to run, the interface is the part that I have not yet figured out. 

The user interface and appropriate Apple program architecture is what all those books are about.  When I talk about MacOSX programming, it mostly refers to building visual applications using Cocoa, Appkit, and the whole Apple programming foundation.  Reminds me, you might want to look up for books on Cocoa programming.  That’s another searchable term that could get you some useful resources.
3 - I build similar software using combinations of Swift, C, C++, Objective-C, Objective-C++, and Fortran.  Fortran is a little tricky, but I am starting to get it to work.  The only real glitch I have is that Swift <-> C++ needs a shim layer based on either C or Objective-C/Objective-C++ (I use Objective-C++ most of the time because of the easy interacting with C++ objects and routines, but C/Objective-C are useful at times).
I programmed in FORTRAN - a long time ago. With C, I can find libraries like sorting, etc. I do a lot of sorting. C++ also has libraries and I am sure that Objective-C does, I just gotta find them.
Fortran still has numerical computing down. It’s I/O was always simpler in my view than anything I’ve seen.   NAMELISTs made life easy many times.
That’s why I use multi-languages for a variety of purposes.

What kind of libraries are you looking for?  Also, the same compiler (clang) is used for C, C++, Objective-C, and Objective-C++ on Mac platforms.  Any C/C++ libraries you may be using now can be used with Objective-C/Objective-C++.  And, Objective-C can be used to build command line applications if you want.  Objective-C code does not have to be used only within a MacOS application.  Objective-C actually pre-dates MacOSX, goes back to the ’70s.
4 - Objective-C/Objective-C++ are super-sets of the C/C++.  If it compiles in C/C++, it will compile in Objective-C/Objective-C++, but, not vice versa.
 
5 - You can tell Xcode to compile a file using the Objective-C++ compiler by giving it a file extension of “.mm”.
Hmmm. That might come in handy sometime. 
6 - A minimal MacOS desktop application consists of main.m, AppDelegate.h, ViewController.h, and ViewController.m files.  You should have gotten an AppDelegate.h even in Xcode 9, if you are building a desktop application.  If you are building a command line application, all you get is a main.m.
 
7 - There is lot of documentation on the AppKit architecture you get to within Xcode, on the developer.apple.com site, the Internet, and in MacOS programming books. The Xcode Help also has a pretty good starter guide for Interface Builder.
 
8 - A Mac Desktop application is not like a command line application.  You have to worry about timer events, user events, run loops to manipulate the graphical user interface.  As an aside, you can archive your command line application in Xcode, then export the archive which will get you a copy of the command line executable you can run on the command line without having to use Xcode to run it.
Right now I build files of orbits and run my applications to find various parameters for each - like take a satellite and find perigee over time. So a command line type application works for me, the application runs on the target file and outputs several results files. But I hope that if I had a desktop application I could give it the satellite number and the application would parse a big file of various satellites to get the ones that I needed. 
Charles

No reason you can’t do that with a command line application, if you want.  I’m assuming you are familiar with argc and argv.  You can use atoi() on an appropriate argv element, and use that number as your key to that file.  That won’t come automatically with building a desktop app.  If you want to have a windowed interface with a textfield to put the number in, to display results, to generate your plots. make it double-clickable, then, yeah, building a desktop application is the way to go.  But, there is a learning curve that you will have to climb.

If you are building a MacOS desktop application, you might want to look at using Swift.  Swift, in my view, is a little easier to move into especially from a C/C++ background if you don’t have a lot of experience with the Apple frameworks (which, if you are building a desktop application, is 75% of the effort especially if you got the model code down like it sounds like you do).

I’ve been doing this kind of scientific programming since I was 17 in 1966.  So, I know where you are coming from.

Jonathan


Jean-Christophe Helary <jean.christophe.helary@...>
 

Charles,

This book used to be highly praised when Objective-C was hot for macos application development:

https://ptgmedia.pearsoncmg.com/images/9780321942067/samplepages/032194206X.pdf

I'm sure you can find a full PDF somewhere to check the contents and see if you want to buy a paper version.

Jean-Christophe Helary

On May 17, 2020, at 2:04, Charles Phillips <phillipstriples@att.net> wrote:

All -

I have written "command line" applications for a couple of years - actually I edit my code and run it from within XCode. It is not elegant but it works great; they are in C and C++ so far. They take orbital information for satellites and find other parameters like apogee and perigee. I read from input files and write out various files as needed. So I actually do not run the applications from the command line, doing that would be an extra couple of steps.

I have looked around for books and support forums of course, they are not easy to find (anything that talk about Macs).

Now I'd like to make the applications easier to use, it would be handy to have a stand alone application. But I want to run them on Macs and they do not lend themselves to use on a iPhone at all - I need a bigger screen. I was able to look at some books in bookstores that talked about programming for Macs (before this stay at home stuff started) but they all talked about Swift and none seemed to have an example of one that was going to run on a desktop/laptop. So I got a book from Amazon "Objective-C for Absolute Beginners" because it sounded like it might have some desktop examples. But it also only has examples for iPhones! I went with Objective-C because I would like to find some examples designed for use on a bigger screen.

Fortunately most of my C code compiles with Objective-C, a printf works for an NSLog in my needs. I can write a lot of this in Objective-C but my C code compiles just fine so I am not spending time to rewrite it.

On myt MacBook Pro I have XCode 9, it gives me ViewController.h and ViewController.m - those are the files that I think I need to work from. I start a project with XCode (version 11) and tell it that I am writing for MacOS and using Objective-C, it gives me AppDelegate.h etc. I wonder if those are specific to iPhones?

This is so wrong but I was writing the code that should be in the .h and .m files, but put it in main.m - so I didn't need to #import it. Still, this is not the school solution so I am fixing that. So main.m has @interface - @end, etc.

Finally, my questions: Is there a support forum that will not cost me $99 per year? Yes I am starting off cheap. Is there a book out there that has desktop examples? I bought a book Objective-C for Absolute Beginners, hoping that it would have examples for a desktop - it does not! Grr. I decided to start with Objective-C hoping that I could find examples of code that ran on desktops but it seems hard to find.

I use XCode 9 and 11.3.1 but I am pretty sure that I can just write the code by hand and then figure out where it should really go later.

I rewritten this note several times, just writing it has helped me answer some questions. What I am trying to learn is far more "Interface Builder" and its current incarnation more than coding or how to use XCode.

Thanks. Please don't roast me, what I have works but it is not "right" yet. An example of what my code does:

https://www.thespacereview.com/article/3820/1

Charles
Houston, Texas
Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune