TweakPrimaryView

public protocol TweakPrimaryView : UIView, TweakView

A view to show/change the value of a tweak.

Primary means it is displayed alongside with the tweak name in the list UI.

Each tweak list will maintain a reuse poll of primary view, so a list with hundreds of tweaks will not initialize hundreds of primary views.

Every tweak must have a primary view. The primary view is used for tweaking the value. For example, Bool uses a switcher as its primary view.

  • The reuse id of the view.

    Declaration

    Swift

    var reuseID: String { get }
  • The natural size for the receiving view, considering only properties of the view itself.

    Custom views may have content that they display of which the layout system is unaware. Setting this property allows a custom view to communicate to the layout system what size it would like to be based on its content.

    Declaration

    Swift

    var intrinsicContentSize: CGSize { get }
  • extendInset Default implementation

    The extend inset for hit-testing.

    Custom views may want some extra area outside of their frame to be interactable.

    If this method is not implemented, then the return value is assumed to be zero.

    Default Implementation

    Declaration

    Swift

    var extendInset: UIEdgeInsets { get }
  • Reload the view with a tweak.

    Declaration

    Swift

    func reload(withTweak tweak: AnyTweak, manually: Bool) -> Bool

    Parameters

    tweak

    the tweak to reload with.

    manually

    A flag indicates whether the update operation is triggered manually by users.

    Return Value

    Whether needs to relayout after reloading the view.

  • reset() Default implementation

    Resets the states of the view.

    This is a optional method.

    Default Implementation

    Declaration

    Swift

    func reset()