According to the release notes of STP, OffscreenCanvas has been implemented for a while. However, when I run JavaScript code, it fails because OffscreenCanvas is not a recognized command. I feel I’m missing something obvious here. Any help?
Post
Replies
Boosts
Views
Activity
I am trying to implement Quick Notes through SwiftUI, rather than UIKit or AppKit. I am unsure if the behaviour below is expected, or due to a bug.
I have already successfully implemented NSUserActivity for Handoff, Spotlight and Siri Reminders, using the .userActivity() view modifier. These NSUserActivity instances use the NSUserActivity.userInfo dictionary to store and correctly restore the content through the .onContinueUserActivity(perform: ) methods.
Quick Notes requires using the .persistentIdentifier or .targetContentIdentifier properties, rather than the .userInfo dictionary alone. However, when I set these either of these to unique identifiers using the code below, they are not correctly stored within the useractivity.
MyView()
.userActivity(ActivityString, updateUserActivity)
private func updateUserActivity(_ activity: NSUserActivity) {
activity.isEligibleForSearch = true
activity.isEligibleForHandoff = true
activity.title = "Title"
activity.targetContentIdentifier = myItemUniqueID
activity.persistentIdentifier = myItemUniqueID
activity.userInfo = ["id": myItemUniqueID]
print(activity.targetContentIdentifier) // Correctly prints
print(activity.persistentIdentifier) // Correctly prints
print(activity.userInfo) // Correctly prints
}
The identifiers print correctly when setting the user activity above. However, when restoring the user activity (tested through Handoff and Spotlight Search), the targetContentIdentifier and persistentIdentifier strings are empty.
MyView()
.onContinueUserActivity(ActivityString, perform: continueUserActivity)
private func continueUserActivity(_ activity: NSUserActivity) {
print(activity.persistentIdentifier) // Nil
print(activity.targetContentIdentifier) // Nil
print(activity.userInfo) // Correctly prints
}
Is there something else I must do, or is this unexpected behaviour?