Contents

typedPayload(_:)

Decodes the user activity’s user info dictionary as an instance of the specified type.

Declaration

func typedPayload<T>(_ type: T.Type) throws -> T where T : Decodable, T : Encodable

Parameters

Return Value

The type-safe instance.

Discussion

Use this method to retrieve information from the user activity’s userInfo dictionary in a type-safe manner.

If the type can’t be decoded from the userInfo dictionary, this method throws NSUserActivity.TypedPayloadError.invalidContent.

See Also

Managing type-safe access to user info