TweakContextDelegate

public protocol TweakContextDelegate : AnyObject

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

Trade

  • tradeSources(for:) Default implementation

    Asks the delegate for the trade sources of the context during import.

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

    Default Implementation

    Declaration

    Swift

    func tradeSources(for context: TweakContext) -> [TweakTradeSource]

    Parameters

    context

    The context asking the trade source.

    Return Value

    An array of the TweakTradeSource objects.

  • tradeDestinations(for:) Default implementation

    Asks the delegate for the trade destinations of the context during export.

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

    Default Implementation

    Declaration

    Swift

    func tradeDestinations(for context: TweakContext) -> [TweakTradeDestination]

    Parameters

    context

    The context asking the trade destinations.

    Return Value

    An array of TweakTradeDestination objects.

Search

  • shouldFuzzySearch(for:) Default implementation

    Asks the delegate whether performs fuzzy search when searching tweaks.

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

    Default Implementation

    Declaration

    Swift

    func shouldFuzzySearch(for context: TweakContext) -> Bool

    Parameters

    context

    The context requesting this information.

    Return Value

    True if performs fuzzy search; otherwise, false.

  • shouldSmartcaseSearch(for:) Default implementation

    Ask the delegate whether uses smartcase when searching tweaks.

    When using smartcase, if the keyword contains an uppercase letter, it is case sensitive, otherwise, it is not.

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

    Default Implementation

    Declaration

    Swift

    func shouldSmartcaseSearch(for context: TweakContext) -> Bool

    Parameters

    context

    The context requesting this information.

    Return Value

    True if uses smartcase; otherwise, false.

  • shouldCaseSensitiveSearch(for:) Default implementation

    Asks the delegate whether ignores cases when searching tweaks.

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

    Default Implementation

    Declaration

    Swift

    func shouldCaseSensitiveSearch(for context: TweakContext) -> Bool

    Parameters

    context

    The context requesting this information.

    Return Value

    True if respects case in the search keyword; otherwise, false.

  • maxSearchHistoryCount(for:) Default implementation

    Asks the delegate for the max display search history count.

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

    Default Implementation

    Declaration

    Swift

    func maxSearchHistoryCount(for context: TweakContext) -> Int

    Parameters

    context

    The context requesting this information.

    Return Value

    The max display search history count.

  • searchDebounceDueTime(for:) Default implementation

    Asks the delegate for the debounce due time (in seconds) to perform search when inputting keywords.

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

    Default Implementation

    Declaration

    Swift

    func searchDebounceDueTime(for context: TweakContext) -> TimeInterval

    Parameters

    context

    The context requesting this information.

    Return Value

    The debounce due time (in seconds) to perform search when inputting keywords.

UI

  • willShowTweakWindow(for:) Default implementation

    Informs the delegate when the window of the context will show.

    Default Implementation

    Declaration

    Swift

    func willShowTweakWindow(for context: TweakContext)

    Parameters

    context

    The context informing the delegate of this event.

  • didShowTweakWindow(for:) Default implementation

    Informs the delegate when the window of the context did show.

    Default Implementation

    Declaration

    Swift

    func didShowTweakWindow(for context: TweakContext)

    Parameters

    context

    The context informing the delegate of this event.

  • willDismissTweakWindow(for:) Default implementation

    Informs the delegate when the window of the context will dismiss.

    Default Implementation

    Declaration

    Swift

    func willDismissTweakWindow(for context: TweakContext)

    Parameters

    context

    The context informing the delegate of this event.

  • didDismissTweakWindow(for:) Default implementation

    Informs the delegate when the window of the context did dismiss.

    Default Implementation

    Declaration

    Swift

    func didDismissTweakWindow(for context: TweakContext)

    Parameters

    context

    The context informing the delegate of this event.

  • shouldRememberLastTweakList(for:) Default implementation

    Asks the delegate whether remembers the tweak list shown in the UI when dismiss the tweak window.

    If this method returns true, then the tweak window will show the last shown list first at the next time.

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

    Default Implementation

    Declaration

    Swift

    func shouldRememberLastTweakList(for context: TweakContext) -> Bool

    Parameters

    context

    The context requesting this information.

    Return Value

    True if the tweak window will show the last shown list first at the next time; otherwise, false.