Protocols

The following protocols are available globally.

  • Methods for configuring trade, search and UI related behaviors in a context.

    See more

    Declaration

    Swift

    public protocol TweakContextDelegate : AnyObject
  • A type that can be stored by TweaKit.

    Since TweaKit stores object in the form of Data, so the responsibility of Storable is to perform the conversion between Self and Data.

    See more

    Declaration

    Swift

    public protocol Storable
  • A type with value that can be converted from/to TweakTradeValue value.

    Trade is the combination of import and export.

    See more

    Declaration

    Swift

    public protocol Tradable
  • Undocumented

    See more

    Declaration

    Swift

    public protocol TweakTradeDestination
  • A type that represents a import source.

    See more

    Declaration

    Swift

    public protocol TweakTradeSource
  • A type-erased tweak.

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

    See more

    Declaration

    Swift

    public protocol AnyTweak : AnyObject
  • A type-erased tweak that can be traded.

    See more

    Declaration

    Swift

    public protocol AnyTradableTweak : AnyTweak
  • A abstract type that represents a tweak. Every tweak type has its own unique logic. For example, numeric tweak need handle minimum/maximum value but selection tweak need to handle the selection options.

    TweaKit uses different types for each tweaks under the hood. But we don’t want to expose these types and to provide a unified API for users.

    So instead of writing code like:

    NumericTweak("one tweak", defaultValue: 1, from: 1, to: 100, stride: 1)
    SelectionTweak("another tweak" defaultValue: 1, options: [1, 2, 3])
    

    We can write code like:

    Tweak("one tweak", defaultValue: 1, from: 1, to: 100, stride: 1)
    Tweak("another tweak" defaultValue: 1, options: [1, 2, 3])
    

    We use TweakType to implement a class cluster that groups a number of private, concrete tweak subclasses under a public, abstract superclass Tweak.

    See more

    Declaration

    Swift

    public protocol TweakType
  • A type whose value can be tweaked and traded.

    It’s a combination of Tweakable and Tradable.

    See more

    Declaration

    Swift

    public protocol TradedTweakable : Tradable, Tweakable
  • A type whose value can be tweaked.

    See more

    Declaration

    Swift

    public protocol Tweakable : Storable
  • 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.

    See more

    Declaration

    Swift

    public protocol TweakPrimaryView : UIView, TweakView
  • A type with values that support addition and subtraction.

    See more

    Declaration

    Swift

    public protocol TweakPrimaryViewStrideable : Comparable, Numeric, Storable
  • A view to show/change the value of a tweak.

    A tweak 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.

    TweKit shows a secondary view in a bottom panel sheet.

    See more

    Declaration

    Swift

    public protocol TweakSecondaryView : UIViewController, TweakView
  • A type with values that can be displayed in tweak secondary view.

    See more

    Declaration

    Swift

    public protocol TweakSecondaryViewItemConvertible : Equatable, Storable
  • A view to show/change the value of a tweak.

    See more

    Declaration

    Swift

    public protocol TweakView
  • Undocumented

    See more

    Declaration

    Swift

    public protocol TweakBuildable