Date   

Re: Newbie Question About Writing Applications For Desktop/Laptop

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


Re: Newbie Question About Writing Applications For Desktop/Laptop

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


Re: Newbie Question About Writing Applications For Desktop/Laptop

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


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


Re: Xcode 11 unusable?

Sak Wathanasin
 



On 12 May 2020, at 04:55, Jack Brindle via groups.io <jackbrindle@...> wrote:

The xml for the xib seems to be perfect, it is the rendering within IB that needs a lot of help. Quitting Xcode and reopening the project will get the xib back to the way it should look until you do any manipulation.

Are you talkng about the preview window or the std wireframe that we know and (er) love?

I have a fairly complicated window with tableviews inside tab views (basically the user can select different tables to look at). The cellviews have embedded views (icons, text, progress bars &c). There are constraint both within the cells and tableview. And, yes, if I show the preview window, it slows down badly, but it isn't unusable.

Sak



Re: Xcode 11 unusable?

Leo
 

On Mon, May 11, 2020 at 08:55 PM, Jack Brindle wrote:
I have been able to recreate this in a fresh project under Xcode 11...
This must be a "lite" version of this bug. The one I have would render Xcode 11 totally useless.

It does confirm though there are some serious bugs lurking in IB.


Re: Xcode 11 unusable?

Leo
 

On Mon, May 11, 2020 at 08:27 PM, Keary Suska wrote:
What if you create a new blank xib and copy/paste the old onto it? I have experienced a couple IB bugs that are hard to detect unless you inspect the XML. Recreating fresh will force IB to rewrite the xib.
Just tried this - didn't help.

Thanks,
Leo


Re: Xcode 11 unusable?

2551phil
 

On 12 May 2020, at 08:03, Leo <leo.r@...> wrote:

Thanks Phil,

Did you find a solution - or I guess it wasn't a project you needed anymore?

The tabView theory looks good. Both my old and new projects have them.

Closing the old project seems to bring back responsiveness. Last time I did that, Xcode error alert told me the storyboard couldn't be saved, though I hadn't made any changes to it.

I do need the old project - the new project is a rewrite and update of it - but I don't need to open IB and can just view the old code files without Xcode. 

I will reproduce and submit a report via Feedback Assistant.


Best


Phil



Re: Xcode 11 unusable?

Jack Brindle
 

I have been able to recreate this in a fresh project under Xcode 11. I did it by creating an NSWindow xib, copying into instances of NSTableView, setting the constraints, then doing other work on the xib. The tableview and window size positioning become very strange quickly, mostly shrinking and expanding within the window. But, when I compile the program and test it, the window and its contents render perfectly. The xml for the xib seems to be perfect, it is the rendering within IB that needs a lot of help. Quitting Xcode and reopening the project will get the xib back to the way it should look until you do any manipulation. Just closing the xib or quitting the project does not reset the display - I have to quit and restart Xcode for that to happen.

Yes, I can duplicate it, at least under Xcode 11.3. Haven’t tried it with 11.4.1 or the new 11.5 beta.

If anyone wants to try, create an NSWindow xib. Drag in an NSTableView with several columns (say 8) at the top of the window, set the constraints to keep the tableview at offset 0 from top and sides, and set the height of the tableview.
Drag in a second tableview (again several columns), setting it perhaps 50 pixels below the first one. Set the constraints to be about 50 down from the top tableview, and 0 offset to the sides, and again 50 pixels to the bottom. Now start adding buttons or other things. Also (and this may be important) drag a textfield into one of the tableview columns. As you start doing these manipulations you should start seeing the image adjust itself in various non-helpful ways.

It makes it difficult to lay out, but not impossible. But, very frustrating. It something that Apple needs to fix.

Jack


On May 11, 2020, at 7:37 PM, Leo <leo.r@...> wrote:

Hi Gary,

Like I mentioned, even if I bring a brand new tab view from the Library, it triggers the issue again.

For example: I delete my original tab view - the problem disappears. I bring a new tab view from the Library - the problem starts again.

It's like if the xib is already "infected" then any tab view will trigger the problem.


Re: Xcode 11 unusable?

Keary Suska
 

What if you create a new blank xib and copy/paste the old onto it? I have experienced a couple IB bugs that are hard to detect unless you inspect the XML. Recreating fresh will force IB to rewrite the xib.

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

On May 11, 2020, at 8:37 PM, Leo <leo.r@rogers.com> wrote:

Hi Gary,

Like I mentioned, even if I bring a brand new tab view from the Library, it triggers the issue again.

For example: I delete my original tab view - the problem disappears. I bring a new tab view from the Library - the problem starts again.

It's like if the xib is already "infected" then any tab view will trigger the problem.


Re: Xcode 11 unusable?

Leo
 

Hi Gary,

Like I mentioned, even if I bring a brand new tab view from the Library, it triggers the issue again.

For example: I delete my original tab view - the problem disappears. I bring a new tab view from the Library - the problem starts again.

It's like if the xib is already "infected" then any tab view will trigger the problem.


Re: Xcode 11 unusable?

Gary L. Wade
 

Interesting! The editable formats of XIBs and storyboards have changed through the years. And if you’ve been watching, you might have noticed that scroll views have gained an explicit clip view rather than an implicit one. Since you say it’s an existing tab view, I wonder if there’s been some kind of implicit/explicit “thing” that’s changed. If you recreate the tab view from scratch and add each component new, I wonder if the issue would remain. You could try a diff of the source text to compare as you go.
--
Gary

On May 11, 2020, at 5:53 PM, Leo <leo.r@rogers.com> wrote:

But I can reproduce the issue with projects that I didn't create - and even with brand new projects in Xcode 11 - if I copy a tab view from my project to a window in the new project.


Re: Xcode 11 unusable?

Leo
 

Thanks Phil,

Did you find a solution - or I guess it wasn't a project you needed anymore?


Re: Xcode 11 unusable?

Leo
 

Ok it looks like I could isolate this issue to a very specific case: a window with NSTabView.

Here's what I discovered:

-If a project doesn't have a window with a tab view, the problem doesn't happen.

-If any of my projects have a window with tab view, the problem is always triggered once I touch this window or any of its elements in IB.

-If I delete the tab view, the problem goes away. Bring back the tab view - problem comes back. It can be any tab view - even a new tab view from the Library.

-No other UI element affects the issue. Only tab view.

-This only happens originally with my projects (which all originated back in Xcode 2-4). I tried some other devs projects with window+tab view and there was no problem.

-But I can reproduce the issue with projects that I didn't create - and even with brand new projects in Xcode 11 - if I copy a tab view from my project to a window in the new project.

-It's sufficient to have just a single window with a tab view and nothing else - so it's not the complicity of the xib that causes the issue.


As you can see I'm having fun here. Very productive.

I'll soon share a brand new Xcode project with a xib that triggers the issue (here at least).


Thanks,
Leo


Re: Xcode 11 unusable?

2551phil
 

FWIW, I have seen exact same problem here in IB of Xcode 11 if I have one of my older projects open. That was built using storyboards. 


Best

Phil 

On 11 May 2020, at 15:10, Sak Wathanasin <sw@...> wrote:



On 11 May 2020, at 03:47, Leo <leo.r@...> wrote:

But I also noticed that issues seem to be triggered by an attempt to manipulate a particularly complex element in Interface Builder such as a complex large window with many UI elements. Relatively simple and small UI elements don't seem to trigger the problem.

So it's some particular XIB files that trigger the issue? Share one if you can & we'll see if we can reproduce it. My guess is that it's some issue in the constraint system.

Sak


Re: Xcode 11 unusable?

Sak Wathanasin
 



On 11 May 2020, at 03:47, Leo <leo.r@...> wrote:

But I also noticed that issues seem to be triggered by an attempt to manipulate a particularly complex element in Interface Builder such as a complex large window with many UI elements. Relatively simple and small UI elements don't seem to trigger the problem.

So it's some particular XIB files that trigger the issue? Share one if you can & we'll see if we can reproduce it. My guess is that it's some issue in the constraint system.

Sak


Re: Xcode 11 unusable?

Leo
 

On Sun, May 10, 2020 at 07:56 PM, Glenn L. Austin wrote:
You might try breaking your complex user interface up into smaller parts, and embed each of those smaller parts into the top-level window.
Thanks for the suggestion, Glenn!

I'm confident though that there's nothing wrong with my interfaces. They are perfectly legitimate xib files that worked with every Xcode version for years - back to versions 3-5.

I hope to hear from back from Apple regarding my bug report... They're often fairly responsive when it comes to developer tools bugs.


Leo


Re: Xcode 11 unusable?

Leo
 

On Sun, May 10, 2020 at 11:21 AM, Alex Zavatone wrote:
If you’re allowed to share any of the stuff that crashes with me, I’ve got a few versions of the OS and Xcode 11 installed on a few of my Macs and can see if I can open them.
Thanks Alex,

By now I also know that exactly the same issue happens on my 2013 MacBook Pro with Catalina. 

To me it means that there's a severe bug in Xcode 11 that affects only certain projects for some reason on any machine.

I appreciate the offer to check my stuff! Indeed I can't share my projects as they're all commercial software - but by this time it's pretty clear that you'd experience the same issues.

It's not a problem to open the projects - it's just once you touch a .xib file with a complex window, Xcode 11 starts disintegrating into rotten mess. 

I'll stick with Xcode 10 for now - and hope to hear something useful from Apple in reply to my bug report.


Leo


Re: Xcode 11 unusable?

Glenn L. Austin
 

Leo,

You might try breaking your complex user interface up into smaller parts, and embed each of those smaller parts into the top-level window.


-- 
Glenn L. Austin, Computer Wizard and Race Car Driver         <><
<http://www.austinsoft.com>

On May 10, 2020, at 7:47 PM, Leo <leo.r@...> wrote:

Thanks Jens,

At this point I could only reproduce it with my own projects (exact same issues on my both iMac and MBP).

But I also noticed that issues seem to be triggered by an attempt to manipulate a particularly complex element in Interface Builder such as a complex large window with many UI elements. Relatively simple and small UI elements don't seem to trigger the problem.

I downloaded some Xcode projects from the Internet to test, and while I didn't have any issues they also didn't have complex UI elements comparable to my projects. 

I couldn't find anything obviously suspicious in lengthy logs produced by Console and Activity Monitor > Sample.

And yes, I submitted bug to Apple. Will update if I ever hear from them.


Leo

 


Re: Xcode 11 unusable?

Leo
 

Thanks Jens,

At this point I could only reproduce it with my own projects (exact same issues on my both iMac and MBP).

But I also noticed that issues seem to be triggered by an attempt to manipulate a particularly complex element in Interface Builder such as a complex large window with many UI elements. Relatively simple and small UI elements don't seem to trigger the problem.

I downloaded some Xcode projects from the Internet to test, and while I didn't have any issues they also didn't have complex UI elements comparable to my projects. 

I couldn't find anything obviously suspicious in lengthy logs produced by Console and Activity Monitor > Sample.

And yes, I submitted bug to Apple. Will update if I ever hear from them.


Leo

 

361 - 380 of 1447