Tweak
public protocol Tweak
A type representing an Orion tweak.
A module should contain zero or one types conforming to this
protocol. If there are zero, Orion will use DefaultTweak.
Tweaks will default to the backend specified via the Orion CLI.
In order to override the backend programmatically, conform to
TweakWithBackend instead.
-
The tweak’s initializer and entry point.
Use this method to perform any custom initialization behavior before
DefaultGroupis activated. To perform initialization behavior afterDefaultGroupis activated, implementtweakDidActivate()instead.Warning
This method is called at launch time, even beforemainhas been invoked. Do not synchronously perform any time-consuming tasks here, because they will make the target process launch slowly.Declaration
Swift
init() -
tweakDidActivate()Default implementationCalled after all of the tweak’s hooks that are in
DefaultGrouphave been activated. The default implementation does nothing.Default Implementation
Declaration
Swift
func tweakDidActivate() -
handleError(_:Default implementation) Handles errors that occur during hooking.
The default implementation simply forwards to
handleErrorDefault(_:), which logs and terminates the process. If you implement this method yourself, however, you can choose to not terminate the process.This method may be called even before
Tweak.init()is called.Default Implementation
Declaration
Swift
static func handleError(_ error: OrionHookError)Parameters
errorThe error that occurred.
-
handleErrorDefault(_:Extension method) The default implementation of
handleError(_:).This method forwards to
orionError(_:file:line:), thereby logging the error and terminating the app withfatalError.If you implement
handleError(_:)yourself, you may call this method at the end of your implementation.See
Declaration
Swift
public static func handleErrorDefault(_ error: OrionHookError) -> NeverParameters
errorThe error that occurred.
View on GitHub
Install in Dash
Tweak Protocol Reference