9 votes

Topic deleted by author

8 comments

  1. [2]
    unknown user
    Link
    You should use Xcode. It's the only sensible choice. Every document or tutorial you reference for macOS development is going to assume you're working in an Xcode environment. Furthermore, when you...

    You should use Xcode. It's the only sensible choice. Every document or tutorial you reference for macOS development is going to assume you're working in an Xcode environment. Furthermore, when you consider the wider scope of developing for macOS or iOS, you need to remember you'll have to deal with notarisation of any apps you create, you'll have to deal with managing an Apple developer account and the certificates that comes with if you want to distribute via the Mac App Store, and you'll need to manage entitlements for any permissions your application requires. Xcode is designed to help manage all of this.

    If you're just getting started, try out SwiftUI, which just got a huge host of updates with WWDC 2020. Also, as far as I know, Xcode is the only IDE which supports real-time rendering of SwiftUI views as you build them.

    5 votes
    1. [2]
      Comment deleted by author
      Link Parent
      1. unknown user
        Link Parent
        I followed the Landmark tutorial! It's good. Some of the pages can be a bit unnecessary, like developing an app icon in SwiftUI, but overall it got me up to speed with developing iOS apps for...

        I followed the Landmark tutorial! It's good. Some of the pages can be a bit unnecessary, like developing an app icon in SwiftUI, but overall it got me up to speed with developing iOS apps for SwiftUI pretty well. I've previously played around with Storyboards a bit and SwiftUI seems like a much quicker way to rapidly prototype.

        1 vote
  2. [4]
    jcdl
    Link
    Followup question: what are some good resources to learn AppKit without searching StackOverflow for 10 year old answers? I'm somewhat comfortable with SwiftUI but I keep banging into its limits...

    Followup question: what are some good resources to learn AppKit without blowing my brains out searching StackOverflow for 10 year old answers? I'm somewhat comfortable with SwiftUI but I keep banging into its limits and have to reach for AppKit more and more often. I don't have much desire to learn ObjC if I can get away with it.

    3 votes
    1. [3]
      joplin
      Link Parent
      What are you trying to do that you're having trouble with? Are you using the documentation built-in to Xcode? The docs let you switch between Objective-C and Swift at the click of a button, which...

      What are you trying to do that you're having trouble with? Are you using the documentation built-in to Xcode? The docs let you switch between Objective-C and Swift at the click of a button, which is nice.

      1 vote
      1. [2]
        jcdl
        Link Parent
        A lot of my frustration comes from not knowing how Interface Builder does its voodoo. I also don't have a firm grasp on what design patterns to use. What classes are okay to use a delegate? Why...

        A lot of my frustration comes from not knowing how Interface Builder does its voodoo. I also don't have a firm grasp on what design patterns to use. What classes are okay to use a delegate? Why doesn't IB let me drag over a delegate linker thingy all the time? What /is/ a delegate? When should I be using a class like NSView and when should I be using an NSViewController? How can I do <x> IB thing purely in code? I have a lot of high level design questions.

        The docs are good once you have a good grasp of what you're supposed to be doing, but I'm not quite there yet.

        1 vote
        1. joplin
          Link Parent
          Yeah, Interface Builder is definitely a confusing piece of the puzzle. You'll probably find that once you've written a few small apps you tend to use the same functionality from it over and over,...

          A lot of my frustration comes from not knowing how Interface Builder does its voodoo.

          Yeah, Interface Builder is definitely a confusing piece of the puzzle. You'll probably find that once you've written a few small apps you tend to use the same functionality from it over and over, and it gets a little easier.

          For what it's worth, even as a macOS developer with decades of professional experience, I find auto layout highly confusing, and have never touched bindings. SwiftUI is pretty cool, but I've found it somewhat limited.

          I also don't have a firm grasp on what design patterns to use.

          The biggest pattern for creating the UI for your app is the Model View Controller (or MVC) pattern. Apple has a pretty good description of it here. While they talk about it in terms of UIKit, it's pretty much the same in AppKit.

          Your "model" is the data your app creates and reads. If you're writing a spreadsheet app, it's the values of all the cells. If you're writing a word processing app, it's the words the user typed and their styles, etc.

          Your views are any classes derived from NSView or UIView. They display the data from the model. They may or may not display all of it, depending on what's appropriate for your particular use case. These are things like text fields, sliders, checkboxes, etc.

          Your controllers hold the logic for updating views when the model changes, or updating the models when the views change. There are a number of ways they can work such as directly modifying both views and model, or by sending notifications which are observed by the views and models. They also can be directly manipulated by your model and views, or can observe notifications from your model and views.

          What classes are okay to use a delegate? Why doesn't IB let me drag over a delegate linker thingy all the time? What /is/ a delegate?

          A delegate is a way of having 2 classes be able to communicate without knowing about each other fully at compile time. A delegate implements a particular protocol (explained below). Say, for example, you want to display a table of students and their scores on the assignments you've given them over the past semester. Apple doesn't know what type of data you'll display in a table, so it created a protocol for the data source for a table view. A protocol is literally just a list of methods that you promise your data source class implements. (In some other languages, this is called an Interface or an Abstract Base Class.) NSTableView doesn't know what class you will use to supply data for the various rows and columns of the table, but in knows that your class will implement methods that tell it things like the number of rows and columns in the table, and that will return an object for each cell of the table. Classes that implement the NSTableViewDataSource protocol are delegates of an NSTableView. (There's also a second type of delegate for an NSTableView — the NSTableViewDelegate — that handles things like how to display the cells. It's the same concept.)

          When should I be using a class like NSView and when should I be using an NSViewController?

          As mentioned above, an NSView displays some piece of data and allows the user to interact with it. An NSViewController mediates between an NSView and your model object. The view controller also has hooks for determining that the app loaded your view from its NIB file or that it was displayed to the user.

          How can I do <x> IB thing purely in code?

          Depends on what <x> is, but generally, if there's an object of some class you're dragging around in IB, you can instantiate one directly in code via something like:

          NSView* myView = [[NSView alloc] initWithFrame:viewFrame];
          

          You then need to manually add it to your view hierarchy by calling:

          [parentView addSubview:myView];
          

          Anyway, if you have other questions, feel free to post them here. I'd be happy to help if I'm able to.

          1 vote
  3. stu2b50
    Link
    For actual MacOS development, like development for a desktop application on MacOS, then it's XCode all the way. In terms of general development on XCode, iterm2 is a must. Then a text editor...

    For actual MacOS development, like development for a desktop application on MacOS, then it's XCode all the way.

    In terms of general development on XCode, iterm2 is a must. Then a text editor you're happy with: vim, VSCode, Sublime are common ones. Make sure to pick up homebrew, and oh-my-zsh (assuming you're using zsh).

    2 votes
  4. joplin
    Link
    Regarding Xcode - it's a very large app with a lot of functionality. The various target settings (and there are literally hundreds of them) can be overwhelming. But the rightmost pane (Inspectors...

    Regarding Xcode - it's a very large app with a lot of functionality. The various target settings (and there are literally hundreds of them) can be overwhelming. But the rightmost pane (Inspectors pane) has a tab for help on each of them! (It's the tab that's a question mark in a circle.) It's pretty awesome and can help make learning what the various settings do a lot easier. Especially for the settings that are just a blank text field.

    The best way to start is by using the templates that Xcode supplies for creating new projects. They're usually set up to help you make a particular type of app along the path of least resistance.

    2 votes