Skip to content

Commit 85bc750

Browse files
committed
(fix) typed throws on overlooked methods
1 parent d05582a commit 85bc750

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Sources/Application.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public final class Application: UIElement {
7575
/// Returns a list of the application's visible windows.
7676
/// - returns: An array of `UIElement`s, one for every visible window. Or `nil` if the list
7777
/// cannot be retrieved.
78-
public func windows() throws -> [UIElement]? {
78+
public func windows() throws(AXError) -> [UIElement]? {
7979
let axWindows: [AXUIElement]? = try attribute(.windows)
8080
return axWindows?.map({ UIElement($0) })
8181
}

Sources/Observer.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public final class Observer {
2525
Application(forKnownProcessID: self.pid)!
2626

2727
/// Creates and starts an observer on the given `processID`.
28-
public init(processID: pid_t, callback: @escaping Callback) throws {
28+
public init(processID: pid_t, callback: @escaping Callback) throws(AXError) {
2929
var axObserver: AXObserver?
3030
let error = AXObserverCreate(processID, internalCallback, &axObserver)
3131

@@ -46,7 +46,7 @@ public final class Observer {
4646
///
4747
/// Use this initializer if you want the extra user info provided with notifications.
4848
/// - seeAlso: [UserInfo Keys for Posting Accessibility Notifications](https://developer.apple.com/library/mac/documentation/AppKit/Reference/NSAccessibility_Protocol_Reference/index.html#//apple_ref/doc/constant_group/UserInfo_Keys_for_Posting_Accessibility_Notifications)
49-
public init(processID: pid_t, callback: @escaping CallbackWithInfo) throws {
49+
public init(processID: pid_t, callback: @escaping CallbackWithInfo) throws(AXError) {
5050
var axObserver: AXObserver?
5151
let error = AXObserverCreateWithInfoCallback(processID, internalInfoCallback, &axObserver)
5252

@@ -101,7 +101,7 @@ public final class Observer {
101101
/// - throws: `Error.NotificationUnsupported`: The element does not support notifications (note
102102
/// that the system-wide element does not support notifications).
103103
public func addNotification(_ notification: UIElement.AXNotification,
104-
forElement element: UIElement) throws {
104+
forElement element: UIElement) throws(AXError) {
105105
let selfPtr = UnsafeMutableRawPointer(Unmanaged.passUnretained(self).toOpaque())
106106
let error = AXObserverAddNotification(
107107
axObserver, element.element, notification.rawValue as CFString, selfPtr
@@ -120,7 +120,7 @@ public final class Observer {
120120
/// - throws: `Error.NotificationUnsupported`: The element does not support notifications (note
121121
/// that the system-wide element does not support notifications).
122122
public func removeNotification(_ notification: UIElement.AXNotification,
123-
forElement element: UIElement) throws {
123+
forElement element: UIElement) throws(AXError) {
124124
let error = AXObserverRemoveNotification(
125125
axObserver, element.element, notification.rawValue as CFString
126126
)

0 commit comments

Comments
 (0)