• A huge new feature for MarsEdit: Mastodon support. Congratulations to @danielpunkass.

    MarsEdit 5.1: Mastodon Support is Here!

  • Happy Thanksgiving!

    youtu.be/Q0UVPHbYo…

  • I am now posting to my blog, and automatically cross-posting to Mastodon. The best way to follow or reach me via Mastodon (or Mastodon-compatible) service is @johnbrayton@iosdev.space. You can also follow my posts via my blog and its RSS feed.

  • I just had a new furnace and water heater installed. The old furnace was 29 years old, the old water heater was 15 years old. I am ready for winter. (Or at least my house is.)

  • Search Suggestion Menus in AppKit

    I recently implemented a search suggestions menu on macOS for Unread.

    Even though Safari, Mail, and Finder implement search suggestion menus, there is no standard AppKit mechanism for providing them in AppKit. Popping up an NSMenu does not work because the search field cannot receive keystrokes while the menu is displayed.

    Interestingly there is a good mechanism for providing search suggestion menus in SwiftUI, but incorporating that mechanism into an AppKit-based application looks much more difficult than just using an NSHostingView.

    I ended up starting with a CustomMenus sample project. This 2018 project by Doug Stein is a Swift port of Apple Objective-C sample code from 2012.

    With that as a base, I updated it to support things like dark mode. I also made it a little more focused on search suggestion menus, as opposed to custom menus in general.

    The result is a sample project on GitHub. I hope you find it useful.

    Thank you to:

  • We have a great agenda for this evening’s CocoaHeads Boston meeting via Zoom. Conall McCabe will give a presentation pertaining to Core Motion, axes of device orientation, and associated data structures.

    www.meetup.com/cocoahead…

  • I helped my city perform a recount yesterday. It is fun to participate in the process.

  • My glass shower door (which has probably been in place for 29 years) spontaneously shattered earlier today. No one was anywhere near it when this happened.

  • Tonight’s online CocoaHeads meeting will include a presentation on Skip, an Xcode plugin that transpiles native SwiftUI iOS apps into Android apps using Jetpack Compose and Kotlin. New participants and participants from outside the Boston area are always welcome.

  • Election

    I was also a precinct clerk, but we don’t get stickers for that. 🤣

    We had a preliminary election for mayor, city council, and school committee in my city today. This is a big one. Our mayor of 20 years is retiring, and it’s the first city election since deciding to have ward-specific city councilors and school committee members.

    Hilariously we (probably) have 3 more elections between now and the end of March.

    “I Voted” sticker.
  • I filed an FB a few days ago regarding the need for an API that does not exist on macOS. Apple replied with “We believe the reported problem has been fixed. Please verify that the issue does not reproduce on macOS 14 beta 7…” 🤦‍♂️

  • Chime is a polished text editor for the Mac with support for several programming languages and an extension API. Now @mattiem@mastodon.social is generously making the app free and releasing the source code.

  • A bird wandering around an indoor train station.

    Photo of bird inside a train station.
  • A fourth indictment. I am starting to suspect Trump might be guilty of some of the crimes we watched him commit on TV. ⚖️

  • CocoaHeads Boston will meet in person next Tuesday, August 22, at Cambridge Brewing Company. New participants are always welcome. Please RSVP on Meetup if you expect to join us so that we can make an educated guess on the reservation size.

  • macOS Bug: Toolbar Images Based on SF Symbols Are Vertically Stretched When Displayed on a 1x Display

    Toolbar images based on SF Symbols are vertically stretched when displayed on a 1x display. I filed this as FB12928137, but wanted to let other developers know. This is tricky because the effect is subtle and because developers without a 1x display will not see the issue. I worked around it by exporting the SF Symbols as 37-point images and putting them in PDFs in the asset catalog. I made each image 55x55, and centered the symbol graphic inside it.

    I created a sample project with a Settings window with a toolbar. When displayed on a 1x display, images in the toolbar based on SF symbols get vertically stretched.

    You can see the effect in the Settings windows of Apple apps, including Apple Mail and Messages.

    To reproduce:

    1. Start with a Mac that has both a 1x and 2x display. In my case I have an M2 MacBook Pro 16” with two external 1x displays. The two external displays are VX2239 Series Display (21.5-inch, 1920x1080) and K272HUL Display (27-inch, 2560x1440). I also encounter the issue if I only have either one of the two displays attached.

    2. Download and run this sample app.

    3. Open its Settings window by selecting “Settings…” under the “SwiftUISettingsWindow” menu.

    4. Drag the Settings window to the 2x display if it is not there already.

    5. Observe that the Speedometer icon is a 40x40 (based on pixels) circle.

    6. Drag the Settings window to the 1x display.

    Expected result: I would expect the speedometer to remain a circle.

    Actual result: The speedometer is a 19x22 oval.

    Sample app Settings window on a 2x display: All toolbar icons look as expected.

    Sample app settings window on a 1x display: The “Speedometer” icon is vertically stretched.

    Alternatively:

    1. Open Apple Mail, and select “Settings…” under the “Mail” menu.

    2. Drag the Settings window to the 2x display, if it is not there already.

    3. Observe that the “@” in the Toolbar above “Accounts” looks as expected, and is 41x42 (based on pixels).

    4. Drag the Settings window to the 1x display.

    Expected result: I would expect the “@” symbol to retain its aspect ratio, with the height being identical to or one pixel taller than the width.

    Actual result: The “@” symbol is 20x24. The gear above “General” also looks vertically stretched.

    Mail Settings window on a 2x display: All toolbar icons look as expected.

    Mail Settings window on a 1x display: The “@” toolbar icon is vertically stretched. The toolbar gear icon above “General” is also vertically stretched.

    Notes:

    1. My sample app uses SwiftUI. I initially saw the issue with an AppKit app using an NSToolbar.

    2. My sample app uses the “speedometer” SF Symbol, but the issue is not specific to that SF Symbol.

    3. I do not have a Mac without a built-in 2x display, so I cannot determine whether the bug affects a Mac that has 1x displays but no 2x displays.

    4. When capturing screenshots for this blog post I ran into a situation where I could not reproduce the issue with Apple Mail immediately. It like seemed the problem had disappeared. Then I reproduced the issue again by ensuring that when I first opened the Mail Settings window, I first opened it on the 2x display and then moved it to the 1x display. Opening on the 2x display does not seem to be required for my sample app though.

    Addendum: It later occurred to me that I am assuming 1x is what is triggering the issue. It could just as easily be using any external display (1x or 2x).

    Update August 15, 2023: Thanks to Michael Tsai for linking to this from his blog. He adds some comments and links to related information from Mario Guzmán.

  • I have not taken a test yet, but I am pretty sure I have COVID. Not a fan.

  • March 2023: No former President has ever been indicted before. No one knows what to expect.

    August 2023: Which of his resorts is hosting the arraignment party?

  • I sometimes have to remind myself that I have very rarely regretted a decision to reduce scope of an app or feature.

  • Exciting day. I bought a car, although I don’t have it yet. And I had the fire department at my house.

    All is well. I had a carbon monoxide detector go off, but the problem is just that the carbon monoxide detector went bad.

  • I am in the process of trying to buy a used car, and I am exasperated by the communication skills of some sellers. Basic things like having an appointment scheduled to look at a car, but needing to ask numerous times for the address.

  • Customer Satisfaction Survey: Are you likely to recommend us to others? If not, why?

    Me: No, because…

    Customer Satisfaction Survey: Can we quote you in our marketing materials?

    Me: 🤣

  • I went to WaterFire tonight in Providence, Rhode Island.

    Fires on the Providence River.
  • Congratulations to @harshil@mastodon.social on the launch of Peak, an app that lets you build your personal fitness dashboard.

  • I finally got a chance to check out Polar Park.

    Worcester Red Sox game at Polar Park

subscribe via RSS