In this release we focused on improving the component focus delegate, making it even easier to both access and observe focused components and views.
The focus delegate now has a new property .focusedView
.
This is the view that is currently in focus, it is optional because there might not be any views selected.
SpotsController has also been slightly changed, the ComponentFocusDelegate
properties .focusedComponent
and .focusedView
are now dynamic so that you can easily observe them using key value observing.
Example
observer = spotsController.observe(\.focusedView, options: [.new]) { (controller, value) in
guard let view = value.newValue else {
return
}
// Do something with the view.
}
The delegate methods related to focus updates on Component has also been improved and should be more reliable.
Merged pull requests: