Catalyst makes it easy for developers with iPad apps to port them to the Mac, allowing them to run on the desktop with few changes to the codebase. Essentially, it’s a very similar approach to Electron, with a major caveat: It only targets one platform, effectively only solving the Apple side of the equation.
![Use Project Catalyst To Run Apps On Mac Use Project Catalyst To Run Apps On Mac](/uploads/1/3/4/1/134149534/573403417.jpg)
- Catalyst allows iPad developers to easily port their iOS apps to the Mac, ultimately enabling universal purchases between the two platforms. While Catalyst has already been used to bring third-party iPad apps, like Twitter, to the Mac, it’s not the same as natively running an iPhone or iPad app on an ARM Mac.
- Project Catalyst is a big deal in Apple circles these days, and for good reason: It refers to Apple’s project to merge development for iOS and Mac apps, allowing you to use them interchangeably.
This tutorial shows how to create and run a .NET Core console application using Visual Studio for Mac.
Note
Your feedback is highly valued. There are two ways you can provide feedback to the development team on Visual Studio for Mac:
- In Visual Studio for Mac, select Help > Report a Problem from the menu or Report a Problem from the Welcome screen, which will open a window for filing a bug report. You can track your feedback in the Developer Community portal.
- To make a suggestion, select Help > Provide a Suggestion from the menu or Provide a Suggestion from the Welcome screen, which will take you to the Visual Studio for Mac Developer Community webpage.
Prerequisites
-
Visual Studio for Mac version 8.6 or later. Select the option to install .NET Core. Installing Xamarin is optional for .NET Core development. For more information, see the following resources:
- Tutorial: Install Visual Studio for Mac.
- Supported macOS versions.
- .NET Core versions supported by Visual Studio for Mac.
Create the app
Create a .NET Core console app project named 'HelloWorld'.
-
Start Visual Studio for Mac.
-
Select New in the start window. How to place startup apps on mac.
-
In the New Project dialog, select App under the Web and Console node. Select the Console Application template, and select Next.
-
In the Target Framework drop-down of the Configure your new Console Application dialog, select .NET Core 3.1, and select Next.
-
Type 'HelloWorld' for the Project Name, and select Create.
The template creates a simple 'Hello World' application. It calls the Console.WriteLine(String) method to display 'Hello World!' in the terminal window.
The template code defines a class,
Program
, with a single method, Main
, that takes a String array as an argument:
Main
is the application entry point, the method that's called automatically by the runtime when it launches the application. Any command-line arguments supplied when the application is launched are available in the args
array.
Run the app
-
Press ⌥⌘↵ (option+command+enter) to run the app without debugging.
-
Close the Terminal window.
Enhance the app
Enhance the application to prompt the user for their name and display it along with the date and time.
-
In Program.cs, replace the contents of the
Main
method, which is the line that callsConsole.WriteLine
, with the following code:This code displays a prompt in the console window and waits until the user enters a string followed by the enter key. It stores this string in a variable namedname
. It also retrieves the value of the DateTime.Now property, which contains the current local time, and assigns it to a variable nameddate
. And it displays these values in the console window. Finally, it displays a prompt in the console window and calls the Console.ReadKey(Boolean) method to wait for user input.Then
represents a newline character.The dollar sign ($
) in front of a string lets you put expressions such as variable names in curly braces in the string. The expression value is inserted into the string in place of the expression. This syntax is referred to as interpolated strings. -
Press ⌥⌘↵ (option+command+enter) to run the app.
-
Respond to the prompt by entering a name and pressing enter.
-
Close the terminal.
Next steps
In this tutorial, you created a .NET Core console application. In the next tutorial, you debug the app.
After a full year of hand-wringing and anticipation, Apple finally gave developers the tools to make cross-platform iOS and macOS apps. Developers can now create apps with (mostly) the same binary for mobile and desktop.
But it’s not the ‘write once, ship everywhere’ pipe dream realized. Instead, as revealed at this year’s WWDC, it’s a lot more like retrofitting mobile apps for the desktop. Text editor app mac.
Here’s what it means for you.
The Bad
- Expect a deluge of bad apps to hit the Mac App Store.
- There’s no unified App Store; developers must post iOS apps to the App Store and macOS apps in the Mac App Store.
- This move further confuses the monetization landscape, especially as it relates to subscriptions.
- The Mac doesn’t have a huge market share.
- It’s not for iPhone apps (yet). Only iPad apps can make the move to Mac.
The Good
- Making iOS apps available to macOS is (conceptually) pretty simple.
- Though it can get confusing, this does open up more avenues to sell apps or encourage users to subscribe.
- Many apps will have an easy time making the move to macOS; there’s not a ton of work to do (more on that in a minute).
- This will undoubtedly help the Mac App Store be not-so-terrible.
Refactor (Our Take)
You’re undoubtedly wondering if this is a good thing. It is.
But it’s a good thing mostly because the Mac App Store is so dreadful. Apple recently made an effort to help the platform via a redesign and a similar editorial effort as the iOS App Store already receives, and it fell flat. It’s hard to discuss great apps and services when you just don’t have great apps and services.
Conceptually, it’s not hard to make an iOS app available for the desktop. Apple promises that minimal work needs to be done, but every developer knows the actual work is always more than anticipated, especially with a new paradigm or platform.
At WWDC, Apple also fell back on its message from last year that AppKit (the tired framework used to develop macOS apps) will handle Mac things such as keyboard input and trackpad/mouse tracking. It’ll also deal with window resizing. And that all sounds simple and awesome, but your apps may not take so well to it.
Some of your functions and method should probably be global, and they’re not. You may be calling an outside library for something Apple has available via its own APIs, and that could bork your port to macOS because the AppKit API call(s) want to work with Apple’s stuff, not third-party tooling. Expect issues.
We think of this like a deprecation of AppKit, much as Objective-C was deprecated when Swift arrived. Swift didn’t kill Objective-C, and the UIKit framework familiar to iOS developers isn’t killing AppKit. You can still write an iOS or macOS app in Objective-C, and you can still write a ‘traditional’ macOS app using AppKit.
Monetization remains confusing. Before today, you could – for example – sell an iOS app for $10, and its macOS counterpart for $20. But once things go cross-platform, asking $30 for what is essentially the same app is a hard sell. Subscriptions are also going to take some work, and we expect many developers will offer up added functionality for desktop apps while keeping the mobile app lighter.
Mac Catalyst App
Apple isn’t ready for iPhone apps to hit the Mac, and it may never be ready for that. The company has been positioning the iPad as a computer, and it’s not; nor is the Mac a mobile device. Nonetheless, apps can be shared between the two devices and platforms fairly simply.
Use Project Catalyst To Run Apps On Mac Os
If this is the dream of ‘Marzipan’ (official, just-revealed name: ‘Project Catalyst’) realized, it’s pretty sweet, and it’ll be exciting to see what comes of it all. Developers will have until the Fall when iOS 13, the new iPadOS, and macOS 10.15 actually land.