Skip to content

Conversation

@aokj4ck
Copy link
Contributor

@aokj4ck aokj4ck commented Jan 17, 2026

  • Resolve 4 UITraitCollection warnings
traitCollectionDidChange

iOS 8.0–17.0 Deprecated
In Swift, use registerForTraitChanges(_:handler:) or registerForTraitChanges(_:target:action:) instead. In Objective-C, use registerForTraitChanges:withHandler: or registerForTraitChanges:withTarget:action: instead.
https://developer.apple.com/documentation/uikit/uitraitenvironment/traitcollectiondidchange(_:)

ShareViewController

  • Testing on iPhone 17 in the simulator with all available Environment Overrides I was not able to find any reason for the trait collection to invoke configurePublishButtonApperance()
    • Important: use the ShareActionExtension target and invoke it from an external app / Safari share sheet
  • All the configuration in configurePublishButtonApperance() should be handled by UIImage + Asset support for switching among light/dark mode

HUDButton

Steps to test:

  1. Open the timeline
  2. Tap on any image attached to a post
    • At this time the (X) and (ALT) buttons font legibility weight should match your default settings (bold/regular)
  3. Use the Xcode debugger's Environment Overrides > Accessibility > Bold Text toggle

Now the (X) and (ALT) buttons font legibility should always match the Bold Text toggle environment override value

AvatarButton

  • Resolve trait collection warning in AvatarButton by removing listening to every trait change
  • Previously used in 1cbc385
  • Previously, in that commit, AvatarButton had background colors and other customization but the trait collection changes are no longer necessary to update background colors / theming because the AvatarButton is displayed in the same style across light and dark modes

MastodonSDK UIImage extensions

  • Remove unused code

…g to every trait change

- Previously used in 1cbc385
- Previously, in that commit, AvatarButton had background colors and other customization but the trait collection changes are no longer necessary to update background colors / theming because the AvatarButton is displayed in the same style across light and dark modes
Steps to test:

1. Open the timeline
2. Tap on any image attached to a post
    - At this time the (X) and (ALT) buttons font legibility weight should match your default settings (bold/regular)
3. Use the Xcode debugger's Environment Overrides > Accessibility > Bold Text toggle

Now the (X) and (ALT) buttons font legibility should always match the Bold Text toggle environment override value
- Testing on iPhone 17 in the simulator with all available Environment Overrides I was not able to find any reason for the trait collection to invoke configurePublishButtonApperance()
	- Important: use the ShareActionExtension target and invoke it from an external app / Safari share sheet
- All the configuration in configurePublishButtonApperance() should be handled by UIImage + Asset support for switching among light/dark mode
@aokj4ck
Copy link
Contributor Author

aokj4ck commented Jan 18, 2026

After these fixes, 23 warnings will remain git grep 'super.traitCollectionDidChange' | wc -l

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant