- How To Make A Simple Mac App In Xcode File
- How To Make A Basic App In Xcode
- How To Make A Simple App In Xcode
- How To Make A Simple Mac App In Xcode Tutorial
Disclaimer
This article is intended for educational purposes only, to demonstrate that it’s possible to test out iOS applications with Xcode without having to buy a Mac. However, you should consider testing on a real MacOS device before publishing your application on the App Store.
Start Xcode on your Mac; Create a new project by choosing File → New → Project from the menu; Choose the Single View App template, from the iOS category, and click Next; Name the project Add 1, choose Storyboard for User Interface, leave the other fields to their defaults, and click Next; Choose a convenient location for the project, such as your Desktop folder; Finally, click Create. Even if you developed your app using something other than a Mac, you will need a Mac to compile the final product that is uploaded to the App Store. Xcode is the primary tool for macOS and iOS.
All the Steps to Get Your First 'Mac'
OK, now let’s discover how a 'Mac' is made.
Requirements
You’ll need a computer running Windows or Linux (not tested) and an iOS device (iPad or iPhone). Also required:
- VMWare or VirtualBox
- USB 2.0, not 3.0
- An Apple Developer account
- Xcode 10.1 (no other versions)
VMWare or VirtualBox?
After having tested various MacOS versions on different virtual machine systems like VMWare and VirtualBox, I found that the quickest solution was VMWare Player 15 with High Sierra 10.13.
Newer versions of MacOS drastically reduce the performance of the system, probably due to newer graphic drivers that aren’t 100% compatible with VM software.
First steps
The first step is to install your VM:
Switch USB
After your VM is fully connected and active, you’ll want to try out the connection to a real-world iOS device.
On VMWare, you have to switch the USB mode from 3.0 to 2.0 to let the 'Mac' see your Apple device.
Once you have that handled, reboot the VM and connect the device while opening iTunes inside the VM. After a few seconds, you should see the device pairing to it.
Apple Developer account
Next you’ll need to prepare your Apple Developer account. Don’t worry, it’s free while you’re testing applications on your local device. You only have to pay to publish your app on the App Store.
How To Make A Simple Mac App In Xcode File
- Register at developer.apple.com
- Login and proceed to developer.apple.com/download/more/
- Search for Xcode 10.1 and download this XCode zip file, around 5.6GB
- Unzip the file and move the App file to the Applications folder.
Xcode version must be 10.1
You should never download any version of Xcode except 10.1.
This is because newer versions aren’t supported on High Sierra 10.13.6. Some people have been able to use the newest version, but it would require modifying some app files and would just make it harder.
If you get the 10.1 version, however, you’ll be ready to code in a few minutes instead of a few hours.
Get some support
There’s a downside to using Xcode 10.1. Battle.net app won't open mac file.
New iOS versions, like iOS 12 or 13, aren’t supported on it. So if you try to run your app on an iPhone with iOS 13, you’ll get a warning that it can’t install on that device.
Luckily there is a really simple fix thanks to this awesome repository on Github. Open up your terminal and type these commands:
Easy!
How To Make A Basic App In Xcode
The Magic Trick Is Complete! Your Personal MacOS Running is Inside Your Preferred OS
Resources and References
Hey guys,
In this post I will show you how to create the famous “Hello World” MacOS App
In this post I will show you how to create the famous “Hello World” MacOS App
Since I am coming from a C# .NET background, this task was a very interesting one.
So what are you going to learn here:
- Get familiar with XCode (IDE for MacOS)
- Learn basic SWIFT (general purpose programming language developed by Apple)
- Create a MacOS App
Setup:
- You will need a MacOS (a virtual machine with MacOS installed on it, is also acceptable)
- You will need to install XCode on your MacOS
So let’s dive right into it…
Create a new Mac project
First you need to launch your XCode.
How To Make A Simple App In Xcode
From the menu there, select Create a new Xcode project. This action will pop up a new window.
From the new window you need to select the option MacOS and then navigate to the Application panel. From there you can choose the App option. Click Next
The next window will allow you to choose options for your new project.
Here you can populate the fields however you want. Just make sure you set the language to Swift and I will be using Storyboard as user interface. For now let’s uncheck all other options. Click Next
How To Make A Simple Mac App In Xcode Tutorial
How to allow an app through firewall on mac. The following step allows you to choose a location for your project
Once you are done doing that, click Create
XCode will take some time in creating your project. But once it is done, it will look something like this:
XCode Workspace Overview
One of the best ways to familiarize yourself with the XCode workspace is to read all about it in the documentation.
XCode: Toolbar
From the Toolbar section we will be using two buttons: Build and Stop button. So go ahead and click on the Build button. XCode will build our current application and run it. It should look like so:
After that just close the application Window and click the Stop button.
XCode: Navigation Area
For the purposes of this tutorial we are going to stay in the Project NavigatorArea, working with the project files.
XCode: Debug Area
The Debug Area is located at the bottom of the application window. By default is split into two parts.
The panel on the left will show us the variables used while debugging. On the other side is the application output. That is all you need to know for now.
XCode: Utilities Area
This is the area where we will spend the majority of the time. This area is quite complex. Therefore, we’ll explain it as we create the application.
XCode: Editor Area
This is the area where we will write our code. In other words, this is the place where we will spend most of our time. Programming in the Editor Area.
Design the application
Now let’s get over to the Main.storyboard.
Here you can see two controllers. One is the Window Controller and bellow it you can see the View Controller. Both of them server a different purpose. For example in order to change the window title property you need to:
- Select the View Controller
- Navigate to Attributes Inspector
- Edit the Title Property
Like it is shown on the next image
The point is, general Window related properties are set this way. You can also move to the Size Inspector, located next to the 2. Attributes Inspector and change the size of the window. Well I think you get it. Try to explore. See what other so called Inspector options are going to change to the window.
![Simple Simple](/uploads/1/3/4/1/134146561/459846999.jpg)
Add UI Controls
Now, let’s see how we can add controls on the Mac Application UI.
- Select the Window Controller
- Click the Library Button
- Search for Label in the Object Browser window
- Drag and Drop the control on the Window Controller
Now repeat those steps and make the View Controller look like the following one:
Controls used:
- Label
- Text Field
- Push Button
The goal for this view is when the button is pressed to display alert (message box) saying “Hello {Your name}”
Adjust the control properties
In order to set the Label PropertyTitle to “Name”, first you need to select the Label control and then navigate to the Attributes Inspector from the Utilities Area and find the Title field.
Do the same process for the ButtonControl.
If you have done everything correctly up until now, your View Controller should look something like the following image.
“Hello World” MacOS App
In order to implement the desired functionality on our small MacOS App, we need to:
- Navigate to the Navigator Area
- Double click the ViewController.swift file
Your XCode editor should change and look like this:
Because we will need to interact with the controls we just added. We need to create and connect IBOutlet properties and IBAction methods to them.
The first code we added is the IBOutlet for the Text Field. We need this property to interact with the Text Field we droped on the View Controller before. As you can see from the code we indeed use the nameTextField.stringValue in our SayHi method.
Now the IBAction method we are going to connect to the button on our View Controller. But before we do that let’s see what is happening in the code.
First we create an instance of the NSAlert class. After that, we set the message text to “Hi {the name inside the Text Field control}”. The style of the alert box is set to Informational. In the end we just add one button with the text “OK”.
We are now ready to connect the IBAction method to the button. But before we do that we also need to connect the Text Field to the IBOutlet property we just created.
XCode: Connect Button to IBOutlet property
The first thing we need to do is double click the Main.storyboard option from the Navigator Area. Next from the View Controller click the following button
After this action, the Utilities Area will activate. From there choose the Connections Inspector and under Outlets locate the property: nameTextField. Click on the circle next to it then drag and drop the connector to the Text Field on the View Controller like so:
Now let’s hook up the IBAction to the Push Button.
For this action you just need to scroll a bit down and find the Received Actions area. There you will notice the method SayHi:and do the same drag and drop but this time drop the connector on the button. Like so:
And that is it… Now just build and run the application from the Toolbar Area.
Application Result: “Hello World” MacOS App
This is how our “Hello World” MacOS App should look like
Take the time and look into my other posts:
Back to Top