Run iOS apps naturally on macOS with Catalyst!
Catalyst by Tutorials shows you how to take all the great apps you’ve built on iOS and run them directly on macOS. But like everything else with Apple, it’s not always as good as you want it to be. This book shows you how to design your apps so that they work well on macOS, what you can and cannot port between the two platforms, and other “gotchas” to keep an eye on when building apps under Catalyst.
This book is for developers who have a good grasp of building iOS apps and want to learn how to port these apps to run on macOS as well.
What is Catalyst?
Formerly known as Marzipan to Apple Insiders, Catalyst lets you expand your iPad apps to macOS. Under Catalina and Xcode 11, developers can now build their iPad apps with macOS as their goal.
So if you have hesitated to port your iPad apps to macOS because you just do not need to learn how to develop for the desktop, then 2019 is your year!
Before you begin
This section tells you some things you need to know before you begin, such as what hardware and software you need, where to find the project files for this book, and more.
Section I: Create a great iPad app
Catalyst is about letting you use code you have written for iOS on macOS. But not just any code. At least for now, you can only run code written for iPad on a Mac. And because most of the code will run on both platforms, there are some things you should do to get your code ready before you dive in to run your app on your Mac.
In this section, you take an app written to run on the iPhone and adapt it to run on the iPad. Then you want to add some features to make it behave like a first-class iPad citizen. And through the magic of Catalyst, these features will make your Mac app even better!
In this chapter you will see for the first time the example app you want to interact with for the rest of this book. Once you are familiar with the basic functionality and architecture, take the first steps towards bringing the app to macOS.
Here you will learn why you should use Split View Controller and get instructions on how to migrate from iPhone style Navigation Controller with master / detail push to Split View Controller.
In this chapter you will learn how to add support for dragging photos from other apps and dropping them in your app. You will also learn how to implement drag and drop for slide shows with smooth animations and cell rearrangement.
In this chapter you will learn how to activate a feature that has been available since the start of the Mac, and which has just come with iOS 13 on the iPad, support for multiple windows.
In this chapter you will learn all about context menus, add support for long-press menus on the iPad and how these menus are automatically ported to Mac.
In this chapter you will learn how to use keyboard commands to navigate a list and delete items, as well as UIKeyCommand and first responder setting.
Learn layout settings, and override individual elements from dark mode, like Mail.app and the browser panel.
Section II: Create a great Mac app
The good news is that most of your code will be useful for both iPad and Mac platforms. But what about the things that are Mac-specific: like mouse support, Touch Bar support and more?
In this section, take the first-class iPad app from the previous section and add Mac-specific touches to make it work well on macOS.
In this chapter, you will take things to the next level by making some adjustments that really make your app shine when running macOS via Catalyst. Throughout the rest of this section, you will delve deeper into several other Mac-specific features. When you’re done, you have the option of a world-class Mac app.
Use UIHoverGestureRecognizer to display a shadow effect when hovering over a diary entry in the trial app.
In this chapter you will learn all about the menu bar by trimming the default menu bar, as well as adding new items to delete, share and add new diary entries.
In this chapter, you will learn how to customize the items on the toolbar, including Share, Paste, and Print.
In this chapter, you will continue to develop your app by adding the toolbar elements to the touchbar.
Section III: Distribute your app
Congratulations! You now have a Mac app. But getting that app to your users can be a little different than on iOS.
In this section you will learn the options for distributing your app and how these options work.
In this chapter you will read about the pros and cons of deployment on the Mac App Store, and learn how to go from Xcode all the way to a released app in the App Store.
In this chapter you will learn how to ensure that everyone with macOS can run your app, as well as how to improve the installation experience for potential users.