You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/posts/post-15/index.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,25 +4,25 @@ title: Demystifying Modern macOS Development
4
4
slug: demystifying-modern-macos-development
5
5
images: [""]
6
6
description:
7
-
topics: [macOS, SwiftUI, Catalyst]
7
+
topics: [macOS, SwiftUI, Catalyst, Swift]
8
8
---
9
9
10
10
# Demystifying Modern macOS Development
11
11
12
12
## Introduction
13
13
14
-
For many years Apple, arguably left the mac to languish for years while it focused on iOS and the iPhone. The mac repeatedly got features years later than its mobile cousins, and the hardware was often behind and underpowered. But now, mac app development is currently in the best state that it has been in a very long time, thanks to three major developments:
14
+
For many years Apple, arguably left the Mac to languish for years while it focused on iOS and the iPhone. The Mac repeatedly got features years later than its mobile cousins, and the hardware was often behind and underpowered. But now, Mac app development is currently in the best state that it has been in a very long time, thanks to three major developments:
15
15
16
16
1. Apple released [Catalyst](https://developer.apple.com/mac-catalyst/), which translates iPad apps into native macOS apps.
17
17
2. SwiftUI's _learn once, apply anywhere_ design has made it dramatically easier to share code between macOS and iOS
18
-
3. Apple silicon allows us to run iOS apps natively on the mac without even translating.
18
+
3. Apple silicon allows us to run iOS apps natively on the Mac without even translating.
19
19
20
-
The good news is that we've never had so many powerful, first-party supported ways to develop mac apps. **The not so good news is that it's never been so confusing.** Today we will dive into the subtle differences between each of these approaches.
20
+
The good news is that we've never had so many powerful, first-party supported ways to develop Mac apps. **The not so good news is that it's never been so confusing.** Today we will dive into the subtle differences between each of these approaches.
21
21
22
22
## Terminology
23
23
Let's briefly revisit some terms so that we can understand some of the differences between each of these approaches.
24
24
25
-
-**Devices**: Here we'll just focus on iPhone, iPad, and mac
25
+
-**Devices**: Here we'll just focus on iPhone, iPad, and Mac
26
26
-**OS**: These are the operating systems. Let's focus on **iOS** and **macOS**.
27
27
-**UI Framework**: For a long time, there were basically two frameworks to be concerned with:
28
28
-**AppKit**: for macOS and macs
@@ -31,25 +31,25 @@ Let's briefly revisit some terms so that we can understand some of the differenc
31
31
-**Architecture**: Some of these devices have processors that are so different that the software is incompatible with each other. The software must be specifically compiled for the correct architecture. In our current context, there's really just 2 architectures that we are concerned with:
32
32
-**Intel x86**: Older macs that run on Intel processors
33
33
-**Apple Silicon**: newer macs, and basically all of Apple's mobile devices.
34
-
-**UI/UX Paradigms**: We would love to have a solution that can automatically port our code from one platform to another, but this is only solving half the problem. Macs and iPads are not only different devices and OS's. **Macs and iPads are entirely different UX paradigms.** A mac is a traditional desktop with a mouse and keyboard. But an iPad, is a touch screen device, with an accelerometer, and GPS, and camera, etc. The point is **these are very different devices with different user expectations.**
34
+
-**UI/UX Paradigms**: We would love to have a solution that can automatically port our code from one platform to another, but this is only solving half the problem. Macs and iPads are not only different devices and OS's. **Macs and iPads are entirely different UX paradigms.** A Mac is a traditional desktop with a mouse and keyboard. But an iPad, is a touch screen device, with an accelerometer, and GPS, and camera, etc. The point is **these are very different devices with different user expectations.**
35
35
36
36
But as we'll see, things started to get even more complicated...
37
37
38
38
[^2]: In 2019, Apple split iPadOS into its own operating system starting with iPadOS 13. However, this difference is more of a marketing difference than anything else. iPadOS is effectively the same OS as iOS, just running on an iPad, and in fact, in your actual code you will check for `iOS`, not for iPadOS. So in order to reduce complexity, in this article we'll just refer to iOS and that will mean both iPhone and iPad.
39
39
40
40
## Cross Platform Confusion
41
-
For many years, AppKit was effectively the only option available to write mac apps. Some of AppKit's API's are verbose and don't feel very "modern". But don't let that fool you. AppKit is a very full-featured, robust framework. It is extremely, flexible and powerful. Unfortunately, it is very difficult to make cross-platform apps with AppKit. If you're going to put all that effort into creating an app, wouldn't you want it to be available on as many platforms as possible? Today's customer's expect apps to be ubiquitous, available on practically any platform. Furthermore, users expect each platform to be at full feature parity. This is quite difficult to achieve in AppKit, since most AppKit code cannot be easily ported to other platforms.
41
+
For many years, AppKit was effectively the only option available to write Mac apps. Some of AppKit's API's are verbose and don't feel very "modern". But don't let that fool you. AppKit is a very full-featured, robust framework. It is extremely, flexible and powerful. Unfortunately, it is very difficult to make cross-platform apps with AppKit. If you're going to put all that effort into creating an app, wouldn't you want it to be available on as many platforms as possible? Today's customer's expect apps to be ubiquitous, available on practically any platform. Furthermore, users expect each platform to be at full feature parity. This is quite difficult to achieve in AppKit, since most AppKit code cannot be easily ported to other platforms.
42
42
43
43
## iPad Apps Translated to macOS Using Catalyst
44
-
Apple realized that there are far more iOS developers, than macOS developers, so they created **Catalyst** to port to macOS. Catalyst is specifically for porting **iPad** apps to **mac**. This means that the same iPad app can run on 2 OS's (macOS and iOS), at least 2 devices (iPad and mac), 2 architectures (Intel and Apple Silicon), in 2 different UI paradigms (touch-first and Desktop), but they are built with one SDK (iOS).
44
+
Apple realized that there are far more iOS developers, than macOS developers, so they created **Catalyst** to port to macOS. Catalyst is specifically for porting **iPad** apps to **Mac**. This means that the same iPad app can run on 2 OS's (macOS and iOS), at least 2 devices (iPad and Mac), 2 architectures (Intel and Apple Silicon), in 2 different UI paradigms (touch-first and Desktop), but they are built with one SDK (iOS).
45
45
46
46
## SwiftUI Apps Running Natively on macOS
47
47
In 2019, the same year that Apple announced Catalyst, they also announced SwiftUI. For a long time, macOS apps must be written in AppKit, and iOS apps must be written in UIKit, but now they could be written with the same framework: SwiftUI. This means much of the same code can be used on both platforms, but not everything. Many methods are only available on one platform or the other.
48
48
49
49
This is why Apple rejects the idea _write once, run anywhere_ and instead describes SwiftUI as _learn once, apply anywhere_. Now this means that the same code[^3] can be run on basically **all of Apple's devices**[^4], basically **all of Apple's OS's**, 2 architectures (Intel and Apple Silicon), in **all of Apple's available UI paradigms** (touch, desktop, watch etc.) and you can choose which SDK you would like to build with.
50
50
51
51
[^3]: or rather **almost** the same code
52
-
[^4]: iPhone, iPad, Apple Watch, mac, Apple TV, Vision Pro etc.
52
+
[^4]: iPhone, iPad, Apple Watch, Mac, Apple TV, Vision Pro etc.
53
53
54
54
## SDK vs. OS
55
55
For a long time the SDK essentially mapped one-to-one to the OS. Building on the iOS SDK created a target that could run on the iOS OS, and only the iOS OS. This is no longer the case. Now you can build a target for the macOS OS using either SDK.
0 commit comments