Protocols
The following protocols are available globally.
-
Methods for configuring trade, search and UI related behaviors in a context.
See moreDeclaration
Swift
public protocol TweakContextDelegate : AnyObject
-
A type that can be stored by
TweaKit
.Since
See moreTweaKit
stores object in the form of Data, so the responsibility ofStorable
is to perform the conversion between Self and Data.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 moreDeclaration
Swift
public protocol Tradable
-
Undocumented
See moreDeclaration
Swift
public protocol TweakTradeDestination
-
A type that represents a import source.
See moreDeclaration
Swift
public protocol TweakTradeSource
-
Declaration
Swift
public protocol AnyTweak : AnyObject
-
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
See moreTweakType
to implement a class cluster that groups a number of private, concrete tweak subclasses under a public, abstract superclassTweak
.Declaration
Swift
public protocol TweakType
-
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,
See moreBool
uses a switcher as its primary view.Declaration
Swift
public protocol TweakPrimaryView : UIView, TweakView
-
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.
See moreTweKit
shows a secondary view in a bottom panel sheet.Declaration
Swift
public protocol TweakSecondaryView : UIViewController, TweakView
-
A view to show/change the value of a tweak.
See moreDeclaration
Swift
public protocol TweakView
-
Undocumented
See moreDeclaration
Swift
public protocol TweakBuildable