VMF_StyledSegmentedControl

@MainActor
class VMF_StyledSegmentedControl : UISegmentedControl

Matches Recovrr’s text switches: six-point outer corners and an inset rectangular selection. UIKit owns the labels, selection, actions, and accessibility. On iOS 26 and later, public background-image APIs preserve the rectangular style instead of the native capsule.

  • Declaration

    Swift

    @MainActor
    private var renderedSegmentSize: CGSize
  • Declaration

    Swift

    @MainActor
    private var backgroundImagesNeedUpdate: Bool
  • Rebuilds custom selection backgrounds when the selection color changes.

    Declaration

    Swift

    @MainActor
    override var selectedSegmentTintColor: UIColor? { get set }
  • Creates a control and registers appearance changes that affect its background images.

    Declaration

    Swift

    @MainActor
    override init(frame: CGRect)
  • Creates a control with UIKit segments and appearance-aware background images.

    Declaration

    Swift

    @MainActor
    override init(items: [Any]?)
  • Restores a storyboard control and registers appearance changes.

    Declaration

    Swift

    @MainActor
    required init?(coder: NSCoder)
  • Invalidates the rendered backgrounds after the inherited tint changes.

    Declaration

    Swift

    @MainActor
    override func tintColorDidChange()
  • Fits the selection images and outer clipping radius to the current bounds.

    Declaration

    Swift

    @MainActor
    override func layoutSubviews()
  • Declaration

    Swift

    @MainActor
    private func registerAppearanceTraits()
  • Declaration

    Swift

    @MainActor
    private func invalidateBackgroundImages()
  • Renders equal-width segment backgrounds without cropping the middle segments’ corners.

    Declaration

    Swift

    @MainActor
    private func updateBackgroundImages(cornerRadius inCornerRadius: CGFloat)