willowtreeapps / vocable-ios

Vocable AAC for iOS - Empowering people to communicate with care takers and loved ones.
https://vocable.app
MIT License
78 stars 20 forks source link

Enable head gaze interactions in SwiftUI #684

Closed moyerr closed 2 years ago

moyerr commented 2 years ago

This PR provides the foundation for enabling head-gaze interactions in SwiftUI view hierarchies. The main entry point for this style of interaction is the GazeButton, which is designed to have a similar API to the built-in Button type.

This PR also includes DocC-compatible documentation comments on many of the new types and methods, which can be viewed in the the documentation window:

Screen Shot 2022-06-01 at 3 44 11 PM

Notes for Reviewers

There are a lot of changes in here, many of which are documentation comments, so I wanted to just give a quick outline of the most important components that comprise this feature:

NOTE: Since this is a foundational PR, no SwiftUI views are actually added to the app yet. However, as an example, I did create a SwiftUI version of the Edit Category Detail screen. I recommend checking out EditCategoryDetail.swift to get an idea of what's possible with these foundational pieces. If you'd like to see it in the app (iPad recommended), navigate to EditCategoriesViewController.swift and replace line 236 with the following lines:

if #available(iOS 15, *) {
  destination = UIHostingController(
    rootView: EditCategoryDetail(objectId: objectID)
      .environment(\.managedObjectContext, NSPersistentContainer.shared.viewContext)
  )
}