Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

Mac OS X Development Tutorial for Beginners Part 1: Intro to Xcode

In this Mac OS X development tutorial for beginners, learn how to create your first "Hello, World" app with Swift and take a tour of Xcode.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1388-mac-os-x-development-tutorial-for-beginners-part-1-intro-to-xcode

Following the tutorial at “https://www.raywenderlich.com/110170/mac-os-x-development-tutorial-for-beginners-part-1-intro-to-xcode”, and I’m having a few newbie problems.

  1. The download instructions for the HubEvent starter project say to unzip it, but this appears not to be necessary; I can see the contents of the HubEvent folder in my Downloads folder without doing anything else.

  2. When updating the AppIcon, the tutorial says to use Finder to locate rw_icon.png in the unzipped directory you downloaded. Then drag this from Finder into the Mac 512pt 2x cell in the AppIcon asset. Problem is, the “rw_icon.png” was not included in the download.

  3. I then attempted to create my own icon at 1024x1024 by using Shift+Clover+4 on a desktop image and inserted it as directed in the tutorial, but when I ran the app, it still showed the default app icon instead of the one I created. Is there something else I’m supposed to do? I have some experience in MS Visual Studio, and adding an icon there involves a couple of steps, so I’m wondering if there’s something else that needs to be done in Xcode?

Thanks in advance.

Another issue arises in the debugging example for GitHub data provider. Proceeding as instructed in the tutorial, I find that the indicated correction was already made in the downloaded file.

In addition to that, the added correction (splitview.setPosition…) makes no difference to the initial position of the split bar whether it is included or commented out.

Having a more fundamental problem with the HubEvent_7.1 - opening it in Xcode Version 8.0 beta 2 (8S162m) and letting it convert to Swift 3 gives the error:
Swift stdlib tool Error Group
(null): The file “HubEvent” couldn’t be opened because there is no such file.Can’t get it to build. Is there an updated version somewhere?

Hi, I have a real newbie question from almost the beginning of “Hello World”: When I try the step of adding a label, my object library shows “no matches” and that doesn’t change when I try typing “label.” What am I doing wrong?

I have this problem also.
Any ideas any one?

Thanks

Hi @the_old_crab,

Sorry for the late reply.

  1. If you use Safari then it’ll automatically unzip ZIP files when you download them. This isn’t true of other browsers (and not necessarily true of Safari).
  2. I’m not sure why that’s not in there - sorry about that. I’ll ask the macOS team lead to take a look at making sure that the start and end projects for this tutorial are updated. In the meantime, here’s the logo file you need:
  3. You shouldn’t have to do anything other that what was specified in the tutorial. Give it a try with this logo and hopefully it’ll work. It might be the strict requirements on image sizes that’s causing the problem.

sam

1 Like

Hi @scarrg,

I’ve just tried the Swift migrator in Xcode 8β6 and it doesn’t seem to suffer from this problem.

It has many, many errors in SwiftyJSON post-migration, but only a couple in the project code. I’d suggest waiting for Swift 3 to become GM with a later seed of Xcode 8, and then go and grab the updated version of SwiftyJSON from the project’s GitHub page.

I’ll also suggest to the macOS team lead that this tutorial is put on the list of ones to get updated once macOS Sierra is released.

sam

Hi @patrickm // @thommoperth

Not entirely sure what to suggest. Maybe you can provide a screenshot of what you’re seeing?

The only thing I can think of is that you need to ensure you’ve selected the Object Library from the panel on the right hand side. That’s the third tab across - and look like a square in a circle. If you search for label in any of the other tabs then you’ll get a “not found” message.

Hopefully that’ll help you sort it :confused:

sam

Hi Sam,

I was having the same problem with the logo as “the_old_crab” on Jul 27. Will see how I go now the logo is provided by you.

Thanks

OK - good luck. Gimme a shout if there’s a problem and I’ll investigate further.

sam

Here is the screenshot: “No Matches” in the object library.

Hrm - how come it says “No Editor”. I’ve never seen that before, and it explains why you can’t find a label. When the storyboard is open it should show you a menu bar, window and view controller. Then you can find a label in the object library and drag it to the view controller’s canvas.

There’s something weird going on with your project - you seem to have a HelloWorldc.xcodeproj inside the project. I wouldn’t surprise me if Xcode refuses to start IB because the project is open twice.

Since this is the hello world project, I’d suggest you start again. Close that project, and start over. Create a new macOS app and go straight to the storyboard. You should be able to see some content then, which will allow you to drag a label on.

sam

The storyboard was open in a different window, but that window had no library panel:

I’ll try starting from the beginning again and see if I run into the same issue.

Ah - that’s odd. Try closing that window, and then (single) clicking on the storyboard in the project navigator. That should open IB in the same window, at which point the object library should work. You might need to select the view controller within the IB window.

OK, started again and got farther this time. But at the step of realigning the label, I got as far as opening the attribute window, then adding the constraints and “Update frames,” but then the “Add constraints” button remains blanked out and I’m unable to click it. (Not sure how to get a screen shot of that because as soon as I go over to the app I use to get screen shots that dialog box closes itself.) I was able to move and resize the label by hand, but I couldn’t follow the method suggested.

Oops, I see what happened. the boxes weren’t checked. Never mind.

1 Like

Hi @samdavies, thanks for your tutorial! I am using Xcode 8 + Swift 3. When I opened the project I got a prompt to convert to Swift 2.3 or 3 and I chose 3. But when I try to run it I get build errors (20 issues) in GitHubData. What do I do?

Looks like a lot of the issues are in SwiftyJSON.swift. I’ve seen an earlier comment from you advising to update that file from GitHub and I found this https://github.com/SwiftyJSON/SwiftyJSON but I don’t know what to do. Please help.

Hi @ad3da,

Sorry about the difficulties you’re having - this is all to do with the changes in Swift 3. The Xcode Swift migrator is far from perfect, so needs some help.

SwiftyJSON will have a version that supports Swift 3. I think you should be able to replace the content of the SwiftyJSON.swift file in the project, with this file:

Alternatively, if you wait a while, this tutorial will soon be updated for Swift 3 by the macOS team. I’m not entirely sure on the schedule though, so if you’re in a rush, the best hope is to import the updated SwiftyJSON and fix any related errors.

sam