Skip to content

Instantly share code, notes, and snippets.

@steipete steipete/UIKit+iOSMac.h
Last active Jan 28, 2019

Embed
What would you like to do?
iOSMac Marzipan Toolbar Access. Learn more at https://speakerdeck.com/steipete/hacking-marzipan
import Foundation
class iOSMacToolbarController {
init() {
print("iOSMac Marzipan extensions initializing.")
guard (NSClassFromString("_UIWindowToolbarButtonItem") != nil) else {
print("iOSMac UIKit Extensions not found.")
return }
let titleButton = _UIWindowToolbarButtonItem(identifier: "com.pspdfkit.viewer.test")
titleButton?.title = "A button"
guard let toolbarController = UIApplication.shared.keyWindow!.value(forKey: "_windowToolbarController") as? _UIWindowToolbarController else {
print("iOSMac KVO error.")
return
}
toolbarController.itemIdentifiers = ["com.pspdfkit.viewer.test"]
toolbarController.templateItems = [titleButton]
print("iOSMac extension initialized.")
}
}
#import <Foundation/Foundation.h>
@class NSString, UHASToolbarItem;
__attribute__((weak_import)) @interface _UIWindowToolbarItem : NSObject
@property(readonly, copy, nonatomic) NSString *label;
@property(readonly, copy, nonatomic) NSString *identifier;
- (id)initWithIdentifier:(id)arg1;
@end
__attribute__((weak_import)) @interface _UIWindowToolbarButtonItem : _UIWindowToolbarItem
@property(nonatomic) SEL action; // @synthesize action=_action;
@property(nonatomic) __weak id target; // @synthesize target=_target;
@property(copy, nonatomic) NSString *imageName;
@property(copy, nonatomic) NSString *label;
@property(nonatomic, getter=isEnabled) BOOL enabled;
@property(copy, nonatomic) NSString *title;
- (void)performAction;
- (id)_ourBackingItem;
- (id)initWithIdentifier:(id)arg1;
@end
@class NSArray, NSSet, NSString;
@protocol UHAToolbarInterface, UHAWindowInterface;
__attribute__((weak_import)) @interface _UIWindowToolbarController : NSObject
/*{
id <UHAToolbarInterface> _toolbar;
id <UHAWindowInterface> _hostWindow;
NSArray *_itemIdentifiers;
NSString *_centeredItemIdentifier;
NSSet *_templateItems;
BOOL _hasExplicitToolbar;
}*/
+ (id)sharedWindowToolbarController;
@property(copy, nonatomic) NSSet *templateItems; // @synthesize templateItems=_templateItems;
@property(copy, nonatomic) NSString *centeredItemIdentifier; // @synthesize centeredItemIdentifier=_centeredItemIdentifier;
@property(copy, nonatomic) NSArray *itemIdentifiers; // @synthesize itemIdentifiers=_itemIdentifiers;
- (void)_refreshToolbar;
@property(nonatomic) BOOL autoHidesToolbarInFullScreen;
- (id)_toolbarCreatingIfNeeded:(BOOL)arg1;
- (BOOL)_hasExplicitToolbar;
- (BOOL)_wantsToolbar;
- (void)updateForMainWindow:(id)arg1;
- (void)updateForMainHostWindowDidChangeNotification:(id)arg1;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.