diff --git a/ScrollSwitcher/AppDelegate.swift b/ScrollSwitcher/AppDelegate.swift index 1f88add..f76955b 100644 --- a/ScrollSwitcher/AppDelegate.swift +++ b/ScrollSwitcher/AppDelegate.swift @@ -14,14 +14,8 @@ class AppDelegate: NSObject, NSApplicationDelegate { // things that need to be retained to keep them from disappearing private var prefPanesSupport: Bundle! private var item: NSStatusItem! - private var observation: NSKeyValueObservation? func applicationDidFinishLaunching(_ aNotification: Notification) { - - // this is where _setSwipeScrollDirection is defined - prefPanesSupport = Bundle(path: "/System/Library/PrivateFrameworks/PreferencePanesSupport.framework") - try! prefPanesSupport!.loadAndReturnError() - item = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength) item.button!.target = self item.button!.action = #selector(menuItemClicked) @@ -84,7 +78,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { // makes system preferences update DistributedNotificationCenter.default().postNotificationName(.swipeScrollDirectionDidChangeNotification, object: nil, userInfo: nil, deliverImmediately: false) // make the actual input behavior update - setSwipeScrollDirection(Int32(new.rawValue)) + setSwipeScrollDirection(new == .natural) } } @@ -96,7 +90,7 @@ extension AppDelegate: NSMenuDelegate { } } -enum Direction: Int, Equatable { +enum Direction: Equatable { case normal, natural static var current: Direction { diff --git a/ScrollSwitcher/ScrollSwitcher-Bridging-Header.h b/ScrollSwitcher/ScrollSwitcher-Bridging-Header.h index 1dfcdaf..1cf2f4b 100644 --- a/ScrollSwitcher/ScrollSwitcher-Bridging-Header.h +++ b/ScrollSwitcher/ScrollSwitcher-Bridging-Header.h @@ -8,6 +8,8 @@ #ifndef ScrollSwitcher_Bridging_Header_h #define ScrollSwitcher_Bridging_Header_h -void setSwipeScrollDirection(int arg0); +#import + +void setSwipeScrollDirection(BOOL natural); #endif /* ScrollSwitcher_Bridging_Header_h */