An easy way to get text information about the currently focused app on OS X.
import Focused
if let highlightedText = Focused.highlightedText() {
popoverController.text = highlightedText
}
else {
popoverController.text = Focused.elementText()
}
The recommended way of installing Focused.swift
is with the CocoaPods dependency manager.
Update your Podfile
:
use_frameworks!
pod 'Focused', git: 'https://github.com/jimmyhillis/Focused.swift'
Copy and paste Focused.swift
into your project code.
Return positioning information about the focused app for overlay positioning of external applications.