HBLOHandler
@interface HBLOHandler : NSObject
A handler is a class that is consulted by Opener when the system is about to open a URL. If a handler returns an NSURL from openURL:sender:, this URL will be used instead. If the handler doesn’t want to replace the URL, it returns nil.
Opener handles enabling and disabling of the handler for you. If you would like to override this and provide your own preferences, you can set preferencesBundle and preferencesClass.
-
Name of the handler, shown in Settings.
Declaration
Objective-C
@property (readwrite, retain, nonatomic) NSString *_Nonnull name;
Swift
var name: String { get set }
-
Identifier of the handler, used internally by Opener.
To prevent conflicts, use a reverse DNS name, such as your package’s identifier. If your handler previously supported Opener versions prior to 2.0, use the name you passed to -[HBLibOpener registerHandlerWithName:block:] so the user’s preferences are retained.
Declaration
Objective-C
@property (readwrite, retain, nonatomic) NSString *_Nonnull identifier;
Swift
var identifier: String { get set }
-
Custom Preferences list controller bundle.
If nil, a switch will be shown in Settings, and enabled/disabled state is handled by Opener. Otherwise, tapping the cell will push your list controller, and enabled state is handled by your code.
See
preferencesClassDeclaration
Objective-C
@property (readwrite, retain, nonatomic, nullable) NSBundle *preferencesBundle;
Swift
var preferencesBundle: Bundle? { get set }
-
Custom Preferences list controller class.
Refer to preferencesBundle for more details. If this is nil, the principal class of the bundle will be used.
See
preferencesBundleDeclaration
Objective-C
@property (readwrite, retain, nonatomic, nullable) NSString *preferencesClass;
Swift
var preferencesClass: String? { get set }
-
Called when a URL is opened in order to check if your handler has an override of the URL.
Declaration
Objective-C
- (nullable id)openURL:(nonnull NSURL *)url sender:(nullable NSString *)sender;
Swift
func open(_ url: URL, sender: String?) -> Any?
Parameters
url
The original URL that the user wants to open.
sender
The bundle identifier of the app that invoked the URL open request. If the request was invoked through SpringBoard or a non-graphical program such as
uiopen
, this argument is nil. @returns An NSURL that will be opened instead of the original, an NSArray of NSURLs for multiple apps, or nil to not change the URL.