InstantDocumentDescriptor

Swift

public extension InstantDocumentDescriptor
  • Returns the value to be assigned as the group of newly created annotations and comments.

    Instant uses this value to set the group of new annotations and comments you create. By default, the value returned by this method corresponds to the default_group claim of the last JWT used to successfully authenticate the receiver. The value can be modified in one of the following ways:

    1. By re-authenticating the receiver using a JWT that contains a different default_group claim.
    2. By calling overrideDefaultGroup(with:) override the value from the JWT.
    3. By calling resetDefaultGroup(), to undo any prior call to overrideDefaultGroup(with:)

    Throws

    This method will throw an error when the receiver has not been downloaded yet, or when it has already been invalidated.

    Declaration

    Swift

    func defaultGroup() throws -> String?

    Return Value

    Returns the active override or, when no override is in effect, the last confirmed default_group claim from the JWT used to authenticate the receiver.

  • Temporarily overrides the group to use when creating a new annotation or comment.

    By default, Instant uses the default_group claim of the last JWT used to successfully authenticate the receiver to set the group of new annotations and comments you create. In order to assign a different group without having to re- authenticate, you can use this method specifying the desired alternative value. The override will be in effect until you call resetDefaultGroup().

    Note

    If you don’t have permission to change the group of annotations or comments the server will reject these objects, leading to their deletion.

    Throws

    This method will throw an error when the receiver has not been downloaded yet, or when it has already been invalidated.

    Declaration

    Swift

    func overrideDefaultGroup(with group: String?) throws

    Parameters

    group

    The group to be assigned when creating new annotations or comments.

  • Resets the default group to the value from the last successfully authenticated JWT for this layer, returning the new value.

    Call this method to undo the effect of any previous overrideDefaultGroup(with:) call on this object.

    Throws

    This method will throw an error when the receiver has not been downloaded yet, when it has already been invalidated, or when reading the original claim from local storage fails.

    Declaration

    Swift

    func resetDefaultGroup() throws -> String?

    Return Value

    The group to be assigned when creating a new annotation or comment until the receiver is re-authenticated using a different JWT or a successful explicit override using overrideDefaultGroup(with:).