Difference between revisions of "macOS Big Sur changes for developers"

From Free Pascal wiki
(ARM64/AArch64/AppleSilicon Support)
m (ARM64/AArch64/AppleSilicon Support)
Line 182: Line 182:
  
 
{{Warning|When you wish to build a newer version later on, make sure to restart at step 1. As always, compiling the trunk sources is only supported when you start with one of the latest two FPC releases, or with a compiler built from the same trunk sources. Starting with a trunk compiler built using previous trunk sources is not and never will be supported.}}
 
{{Warning|When you wish to build a newer version later on, make sure to restart at step 1. As always, compiling the trunk sources is only supported when you start with one of the latest two FPC releases, or with a compiler built from the same trunk sources. Starting with a trunk compiler built using previous trunk sources is not and never will be supported.}}
 +
{{Warning|At the time of writing (2020/07/20), no command line tools for AArch64 are available yet from Apple. '''xcode-select --install''' will just hang. Do '''not''' manually download and install the command line tools you can get from Apple's developer site, as those do not yet include AArch64 support.}}
 +
  
 
[[Category:macOS]]
 
[[Category:macOS]]
 
[[Category:Lazarus]]
 
[[Category:Lazarus]]
 
[[Category:Platform-sensitive development]]
 
[[Category:Platform-sensitive development]]

Revision as of 19:30, 17 July 2020

Warning-icon.png

Warning: Work in progress


macOSlogo.png

This article applies to macOS only.

See also: Multiplatform Programming Guide

User interface changes

macOS 11 Big Sur introduces many user interface changes that update the appearance of applications and make them more iOS-like. It also adds support for familiar iOS features — such as SF Symbols and text styles.

Icons and Images

macOS 11 refreshes icon design throughout the system and also introduces multipurpose feature icons that can represent items or functions in sidebars and tables. It also adopts iOS SF Symbols. macOS 11 automatically maps AppKit shared images — such as Action, Unlocked, and Share — to specific symbols. In some cases, a symbol might not have the same size or alignment as the AppKit image it replaces, so check your layout.

SF Symbols.png

Application icons

In macOS 11, application icons combine a rounded-rectangle shape, a front-facing perspective, and a consistent drop shadow.

macOS11 app icons1.png

The new design does not preclude judicious expressiveness. For example, the Preview, Xcode, and TextEdit icons continue to combine depictions of the physical objects that best convey the applicationʼs core purpose, while incorporating the new shape, perspective, and shadow.

macOS11 app icons2.png

Document Icons

To compose a document icon, the system combines your application icon with the familiar folded-corner icon shape. If your application opens or creates a large number of document types, you can also supply a custom centre image or background appearance to help people distinguish them.

macOS11 doc icons.png

Feature Icons

A feature icon can represent an item (or category of items), a technology, or a type of information in a table view or in the content sidebar of a preferences window. A feature icon typically uses the macOS 11 rounded rectangle shape to contain a simple, unambiguous glyph, but it can also use custom shapes and colors. For help designing a feature icon, download the production template included in the Apple Design Resources for macOS.

macOS 11 macOS 10.15
macOS11 feature icon.png macOS10 feature icon.png

Application Accent Colours

In macOS 11, you can specify an accent colour to customize the appearance of your applicationʼs buttons, selection highlighting, and sidebar glyphs. The system applies your accent colour when the current value in the user's General > Accent colour preferences is multicolour.

If users set the Accent colour preferences to a value other than multicolour, the system applies their chosen colour to the relevant items throughout your application, replacing your accent colour. The exception is a sidebar glyph that uses a fixed colour you specify. Because a fixed-colour sidebar glyph uses a specific colour to provide meaning, the system does not override its colour when users change the value of Accent colour preferences. To learn more, see Sidebars.

The iCloud glyph remains teal, even when the other glyphs use orange.

iClould glyph.png

Windows and Views

Throughout macOS 11, windows adopt visual cues from iOS interfaces. For example, windows integrate the sidebar, toolbar, and content areas, use an increased corner radius, and display lightweight controls.

macos11 window view.png

Toolbars and Title Bars

By default, toolbars are taller, window titles can display inline with controls, and toolbar items no longer include a bezel.

macOS 11 macOS 10.15
macOS11 tool-title bar.png macOS10 tool-title bar.png

To match the default toolbar’s increased height, toolbar items automatically use the large control size. The exception is an integrated toolbar-title bar area — such as the one in a Safari window — which continues to use the regular control size. To accommodate the new default size, you’ll probably need to adjust the layout of your toolbar.

macOS 11 macOS 10.15
macOS11 tool bar.png macOS10 tool bar.png

Continuing to use the minSize and maxSize APIs to set the size of a toolbar item can clip the control, because the current values don’t account for the larger default size. Use constraints if you need to specify minimum or maximum sizes for a toolbar control.

When horizontal space is limited, the toolbar can display the Search button in place of the search bar. When users click the Search button, the bar expands; when they click elsewhere in the window, the search bar collapses and the toolbar displays the button again.

macOS11 toolbar search.png

In a preferences window, the toolbar can use SF Symbols, but the title position remains above the toolbar buttons. When needed for clarity, individual toolbar buttons can include colour. To indicate the active preference pane, the window applies a system-provided selection appearance to the selected toolbar button.

macOS 11 macOS 10.15
macOS11 prefs toolbar.png macOS10 prefs toolbar.png

If your window includes multiple panes, you can align different subsets of toolbar items with each pane, so that as people resize the window, each set of items remains above its associated view.

Sidebars

In macOS 11, a sidebar extends to the full height of the window. Within the sidebar, default item spacing, row height, and glyph size all increase, and the selected-item highlight uses a rounded-corner appearance.

macOS 11 macOS 10.15
macOS11 sidebar.png macOS10 sidebar.png

A sidebar’s row height, text, and glyph size depend on its overall size, which can be small, medium, or large. You can set the size programmatically, but users can also change it by selecting a different sidebar icon size in General preferences. The table below shows the differences in default sidebar metrics between macOS 11 and previous versions of macOS.

Sidebar size Sidebar component macOS 11 (default) macOS 10.15 and earlier (default)
Small Row height 24pt 22pt
SF symbol scale Medium †
Glyph size 16pt × 16pt
Text size (style) 11pt (Subhead) 11pt
Medium Row height 28pt 24pt
SF symbol scale Medium
Glyph size 20pt × 20pt 18pt × 18pt
Text size (style) 13pt (Body) 13pt
Large Row height 32pt 32pt
SF symbol scale Medium
Glyph size 24pt × 24pt 24pt × 24pt
Text size (style) 15pt (Title 3) 13pt
All Horizontal spacing between cells 17pt 3pt
Vertical spacing between cells 0pt 2pt
† In some cases, a small sidebar may use small-scale SF Symbols by default.

Using SF Symbols is the easiest way to create sidebar glyphs that use the new metrics. Alternatively, you can use PDF template images to create sidebar glyphs; if you must use bitmap images, be sure to create them in small, medium, and large sizes, at both @1x and @2x resolutions.

By default, sidebar glyphs use the current accent colour (to learn more, see Application Accent Colours). If you need to clarify the meaning of an individual sidebar glyph, you can give it a fixed color that persists regardless of the user’s Accent colour preferences. Don’t use the ability to specify a fixed colour to stylize your application as a whole. In macOS, people expect to see their chosen accent colour throughout all the applications they use.

ARM64/AArch64/AppleSilicon Support

macOS 11 Big Sur is the first macOS version that supports Apple's AArch64 processors on the desktop. FPC trunk supports targeting this platform. During the beta period, you will need the Xcode-beta application that you can download from Apple if you are a registered developer (it may also become available as part of a public beta at a later date). The following instructions assume that you are working on an AArch64 Mac, and that the Xcode-beta.app bundle is location in the /Applications folder. You can place it elsewhere and adjust the paths accordingly so long as there are no spaces in the path. The following instructions also assume you have already installed FPC 3.2.0 for Intel.

  1. Compile a native AArch64 compiler
    make distclean
    make FPC=ppcx64 OPT="-ap -FD/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -XR/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" CPU_TARGET=aarch64 -j 4 FPMAKEOPT="-T 4" all > build.log
    
  2. Move the created native compiler to a safe place
    mv compiler/ppca64 .
    
  3. Build a complete native FPC distribution for Darwin/AArch64
    make distclean
    make FPC=$PWD/ppca64 OPT="-ap -FD/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -XR/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" -j 4 FPMAKEOPT="-T 4" OVERRIDEVERSIONCHECK=1 all > build.log
    
  4. Install the built toolchain globally (under /usr/local)
    sudo make FPC=$PWD/ppca64 OPT="-ap -FD/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -XR/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" install
    
  5. Enable the fpc binary to find the AArch64 compiler (ppca64). You only need to do this once, even if you build/install newer build later on (unless the version number of trunk would change)
    sudo ln -sf /usr/local/lib/fpc/3.3.1/ppca64 /usr/local/bin
    
  6. Create a file called ".fpc.cfg" (note the starting ".") in your home directory with the following contents
    #include /etc/fpc.cfg
    -FD/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    -XR/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
    

Now you can use either fpc or ppca64 to compile AArch64 programs.

Warning-icon.png

Warning: When you wish to build a newer version later on, make sure to restart at step 1. As always, compiling the trunk sources is only supported when you start with one of the latest two FPC releases, or with a compiler built from the same trunk sources. Starting with a trunk compiler built using previous trunk sources is not and never will be supported.

Warning-icon.png

Warning: At the time of writing (2020/07/20), no command line tools for AArch64 are available yet from Apple. xcode-select --install will just hang. Do not manually download and install the command line tools you can get from Apple's developer site, as those do not yet include AArch64 support.