Mac Catalyst

From Lazarus wiki
macOSlogo.png

This article applies to macOS only.

See also: Multiplatform Programming Guide

Apple iPadOS.png

This article applies to iPadOS only.

See also: Multiplatform Programming Guide

With macOS 10.15 Apple introduced a new feature for building and running iPad applications on macOS. The feature is named Mac Catalyst.

Apple specifically noted that the apps designed for iPad can be run on Mac computers. Exclusive iPhone apps cannot be run on macOS.

System Support

Mac Catalyst is available on macOS 10.15 Catalina and later (?). It's not available on the prior macOS 10.14.

One might find "iOSSupport" system libraries at

/System/iOSSupport/System/Library/Frameworks

These are run-time frameworks built to support Mac Catalyst.

MacOSX SDKs files already include the necessary iOSSupport reference (.tbd) files.

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/iOSSupport

Limitations

  • According to Apple, only a very small subset of AppKit can be used for Mac Catalyst apps. They must also be isolated into Mac Catalyst specific code (as no AppKit is available on iOS).
  • iPadOS is a version of iOS 13 that's designed to run on Apple's iPads. According to Apple, iPadOS is built on the same foundation as iOS, but with new capabilities created for the larger display of the iPad.

Free Pascal Compiler Support

A new OS target is necessary for the compiler. The changes for the target are as following:

  • during assembly the Mac Catalyst platform needs to be specified. An assembler creates an object file with load commands in them. The command provides the information for the linker about the platform of the object file.
Load command 8
      cmd LC_BUILD_VERSION
  cmdsize 32
 platform macCatalyst.  (platform 6)
      sdk 13.4
    minos 13.4
   ntools 1
     tool ld
  version 556.4
During linking the linker verifies that the platform of the object file generated by FPC matches system linking files.
as of today FPC supports 3 platforms: macOS, iOS and iPhoneSimulator. For Mac Catalyst the additional platform is needed.

Ld

  • "-platform_version" can be used to specify the resulting platform binary version
  • It seems like specifying "macosx_version_min" switches ld down to linking for the macOS platform.

Building Apps

While Mac Catalyst is designed to provide an ability to rebuild iPad apps for macOS in the first place, it is also possible to build a standalone UIKit app for macOS exclusively.

However, such an application might likely act as a proof-of-concept or a demo app, and might not be accepted for distribution in the App store.

External links