Contents

updateUserActivityState(_:)

Updates the state of the given user activity.

Declaration

func updateUserActivityState(_ activity: NSUserActivity)

Parameters

  • activity:

    The user activity to be updated.

Discussion

Subclasses override this method to update the state of the given user activity. You should add state representing the user’s activity into the NSUserActivity object using its addUserInfoEntries(from:) method. When the state is dirty, you should set the needsSave property of the NSUserActivity to true, and this method will be called at an appropriate time.

When an NSUserActivity object managed by UIKit is updated, an empty userInfo dictionary is given to the NSUserActivity object, and all of the objects associated with the NSUserActivity are then sent an updateUserActivityState(_:) message.

See Also

Supporting user activities