-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show goals in Spotlight #472
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @theospears and the rest of your teammates on Graphite |
class BeeminderSpotlightDelegate: NSCoreDataCoreSpotlightDelegate { | ||
|
||
override func attributeSet(for object: NSManagedObject) -> CSSearchableItemAttributeSet? { | ||
if let goal = object as? Goal { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer swift's guard here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The examples in the docs choose this approach because it scales nicely to multiple different types. It's unclear what other types beeswift might want to index though, so I'm leaning towards "either would be fine"
@@ -171,7 +174,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD | |||
UNUserNotificationCenter.current().removeAllPendingNotificationRequests() | |||
} | |||
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { | |||
if let intent = userActivity.interaction?.intent as? AddDataIntent { | |||
if userActivity.activityType == CSSearchableItemActionType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Uses the integration between CoreData and Spotlight to make goal information available in spotlight search.
Testing:
Ran on device and saw the entries appear in spotlight
Verified clicking on items navigates to the app