Avoiding NSUserDefaults on macOS

24 views
Skip to first unread message

Neil Hodgson

unread,
Mar 27, 2024, 3:17:14 AMMar 27
to scintilla-interest
Apple is trying to limit the ability of applications to surreptitiously identify users through collecting system information as a 'fingerprint'.

The NSUserDefaults class can be used to discover a wide range of system information and may require justification for use when publishing on the App Store.

Scintilla currently uses NSUserDefaults for 3 pieces of information: a default font "NSFixedPitchFont", a default font size "NSFixedPitchFontSize", and the double click time "com.apple.mouse.doubleClickThreshold" which is the maximum time one click can follow another and be considered a double click.

An alternative API for the double click time is NSEvent.doubleClickInterval so that will be used.

For NSFixedPitchFont and NSFixedPitchFontSize, which are currently "Menlo-Regular" and 11pt on my machine, I couldn't find an alternate API. The attractive sounding [NSFont monospacedSystemFontOfSize:weight:] returns "SF Mono" instead of "Menlo". It may be reasonable to hard-code "Menlo-Regular" and 11pt here as "Menlo" is available on all supported macOS releases and this is how default font is implemented on Win32 and GTK. Almost all applications will be overriding the font with their own preference system and Scintilla's default is there for simple demonstrations and ensuring something is visible when other code fails.

Neil

Neil Hodgson

unread,
Mar 27, 2024, 10:59:12 PMMar 27
to scintilla-interest
This has now been committed.

Please report any problems or any additional APIs used that would need to be included in privacy manifests.

Neil
Reply all
Reply to author
Forward
0 new messages