In Objective-C accessibility traits are a bitmask. Some devs find tricky to work with them using bitwise operations. In Swift they conform to the OptionSet protocol that conforms to SetAlgebra. That means you can simply insert/remove traits.

Code shows how with Objective-C you need to use bitwise operations to operate with accessibility traits. Bitwise AND (|) for adding traits and bitwise NOT (& ~) to remove them. Accessibility trait none is useful to remove all traits. In Swift, the traits conform to the OptionSet protocol that conforms to SetAlgebra, so you can do things like: insert, remove, formUnion, intersection, isSubset, etc.

You may also find interesting...

When building custom components, or if not relying on UIControl's attributes to configure state, it can be easy to forget to specify the right accessibility traits. These are indispensable for a good experience with VoiceOver, Switch Control...

Check for the traversal order of elements in your app. Sometimes, the default top-left to bottom-right order might not be the most logical one. Sometimes, you may consciously want to tweak the order. Some other times, grouping is the answer.

Touch target sizes are recommended to be at least 44 x 44 points. Buttons in the navigation bar ( especially when not using nav bar button items), dismiss buttons, and custom toolbars, are use cases that tend to have smaller sizes.

Created in Swift with Ignite.

Supporting Swift for Swifts