ActivityCodable

public protocol ActivityCodable

Action input types can conform to this protocol to automatically supply the userInfo for NSUserActivity with the Activities feature.

  • Conforming types must initialise themselves fully from the userInfo supplied, or throw an error.

    Declaration

    Swift

    init(activityUserInfo: [AnyHashable : Any]?) throws
  • Implementations must encode all state required to reconstruct the type again from userInfo of an NSUserActivity using userInfo compatible foundation types.

    Declaration

    Swift

    func encodeForActivity() -> [AnyHashable : Any]?
  • Implementations must return a list of all the userInfo keys required to reconstruct the type again from userInfo of an NSUserActivity at a later point. Only these keys are guaranteed to be persisted and used for machine learning for suggestions etc.

    Declaration

    Swift

    var requiredUserInfoKeys: Set<String> { get }