{"id":31106,"date":"2020-12-22T16:46:00","date_gmt":"2020-12-22T21:46:00","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=31106"},"modified":"2020-12-22T16:46:00","modified_gmt":"2020-12-22T21:46:00","slug":"undocumented-nsshadow-change-on-catalina","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2020\/12\/22\/undocumented-nsshadow-change-on-catalina\/","title":{"rendered":"Undocumented NSShadow Change on Catalina"},"content":{"rendered":"<p><a href=\"https:\/\/lapcatsoftware.com\/articles\/shadow.html\">Jeff Johnson<\/a> (<a href=\"https:\/\/twitter.com\/lapcatsoftware\/status\/1339991416253128706\">tweet<\/a>):<\/p>\n<blockquote cite=\"https:\/\/lapcatsoftware.com\/articles\/shadow.html\"><p>Curiously, the <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/nsshadow\/1429851-shadowoffset\">API documentation for shadowOffset<\/a> is now shared between AppKit and UIKit.<\/p>\n<p>[&#8230;]<\/p>\n<p>So there is a change in behavior of NSShadow shadowOffset in AppKit on Catalina, presumably to emulate UIKit. Sigh&#8230; why does the Mac always have to emulate iOS now? Unfortunately, AppKit developers were not informed of the change, because there were no AppKit release notes published for Catalina.<\/p>\n<p>If you want the shadowOffset to behave as (you) intended on all versions of macOS, both before and after Catalina, the workaround is to check <code>if (@available(macOS 10.15, *))<\/code> and switch the sign of your offset height accordingly.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/jmfd\/status\/1340024630522724353\">Jonathan Deutsch<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/jmfd\/status\/1340024630522724353\">\n<p>Also your article surfaces for me that the number of mandatory \n@available\n checks to workaround bugs and API changes is really getting bad for my app.<\/p>\n<p>@hypeapp\n runs on macOS 10.10+ and has 111 checks! These are for compatibility and not to make use of new OS features.<\/p>\n<\/blockquote>\n\n<p>Also, some enum values have changed <a href=\"https:\/\/developer.apple.com\/documentation\/apple_silicon\/addressing_architectural_differences_in_your_macos_code\">on Apple Silicon Macs<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/documentation\/apple_silicon\/addressing_architectural_differences_in_your_macos_code\"><p>The <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/nstextalignment?language=objc\"><code>NSTextAlignment<\/code><\/a> enumeration uses different numerical values for some constants on <code>arm64<\/code> and <code>x86_64<\/code> architectures. When referring to constants using numerical values, validate that you use the correct values on each architecture.<\/p>\n<p>The <a href=\"https:\/\/developer.apple.com\/documentation\/appkit\/nsimageresizingmode?language=objc\"><code>NSImageResizingMode<\/code><\/a> and <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiimageresizingmode?language=objc\"><code>UIImageResizingMode<\/code><\/a> enumerations uses different numerical values for some constants on <code>arm64<\/code> and <code>x86_64<\/code> architectures. When referring to constants using numerical values, validate that you use the correct values on each architecture.<\/p><\/blockquote>\n\n<p>See <code>TARGET_ABI_USES_IOS_VALUES<\/code> in the headers. I&rsquo;m not sure how this interacts with archiving.<\/p>","protected":false},"excerpt":{"rendered":"<p>Jeff Johnson (tweet): Curiously, the API documentation for shadowOffset is now shared between AppKit and UIKit. [&#8230;] So there is a change in behavior of NSShadow shadowOffset in AppKit on Catalina, presumably to emulate UIKit. Sigh&#8230; why does the Mac always have to emulate iOS now? Unfortunately, AppKit developers were not informed of the change, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2020-12-22T21:46:04Z","apple_news_api_id":"dc0be1d5-1469-4e22-80e9-57c3468a99c7","apple_news_api_modified_at":"2020-12-22T21:46:04Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/A3Avh1RRpTiKA6VfDRoqZxw","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[1941,69,30,1666,1891,71],"class_list":["post-31106","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-arm-macs","tag-cocoa","tag-mac","tag-macos-10-15","tag-macos-11-0","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/31106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=31106"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/31106\/revisions"}],"predecessor-version":[{"id":31107,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/31106\/revisions\/31107"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=31106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=31106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=31106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}