AnyTweak

public protocol AnyTweak : AnyObject

A type-erased tweak.

There are some API that don’t have to expose.

  • The name of the tweak.

    Declaration

    Swift

    var name: String { get }
  • The section that the tweak belongs to.

    Note

    Don’t set the section on your own. The setter is a ugly implementation for now.

    Declaration

    Swift

    var section: TweakSection? { get set }
  • The extra info of the tweak.

    Checkout the doc for TweakInfo for more information.

    Declaration

    Swift

    var info: TweakInfo { get }
  • The current value of the tweak.

    Declaration

    Swift

    var currentValue: Storable { get }
  • The primary view reuse id of the tweak.

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

    For more information about primary view please checkout TweakPrimaryView.

    Declaration

    Swift

    var primaryViewReuseID: String { get }
  • The primary view that the tweak uses.

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

    For more information about primary view please checkout TweakPrimaryView.

    Declaration

    Swift

    var primaryView: TweakPrimaryView { get }
  • A flag indicates whether the tweak has secondary view.

    A Tweakable type can opt-in a secondary view when its primary view has not enough room to display the UI for users to change the value. For example, UIColor uses a secondary view which uses some sliders for adjustment.

    For more information about secondary view please checkout TweakSecondaryView.

    Declaration

    Swift

    var hasSecondaryView: Bool { get }
  • The secondary view that the tweak uses.

    A Tweakable type can opt-in a secondary view when its primary view has not enough room to display the UI for users to change the value. For example, UIColor uses a secondary view which uses some sliders for adjustment.

    For more information about secondary view please checkout TweakSecondaryView.

    Declaration

    Swift

    var secondaryView: TweakSecondaryView? { get }
  • Registers the tweak in the context.

    Declaration

    Swift

    func register(in context: TweakContext)

    Parameters

    context

    The context in which the tweak is registered.

  • disableUserInteraction() Extension method

    Prevents the tweak from being changing value manually.

    Users can still import new value of the tweak.

    Declaration

    Swift

    @discardableResult
    public func disableUserInteraction() -> Self

    Return Value

    The current tweak.

  • id Extension method

    The id of the tweak.

    Declaration

    Swift

    public var id: String { get }