Protocols

The following protocols are available globally.

  • A protocol for decoding JSON data into models.

    The protocol has an extension that provides a default implementation of two non required methods that decode instances of a generic decoding service type from JSON files.

    See more

    Declaration

    Swift

    protocol JSONAccess
  • A protocol for detecting duplicate print numbers used by a client application JSON files.

    The protocol declares a single static variable for a dictionary of duplicate print numbers keyed by EntityLog EntityCode. Any instance conforming to the protocol will need to compile this dictionary for the duplicatePrintNumbersKeyedByEntityCode parameter of the detectDuplicatePrintNumbersWithinEntityLogs(duplicatePrintNumbersKeyedByEntityCode:suppressAlert:) -> Bool method.

    The protocol can detect or verify the detection of two ‘types’ of duplicate: print numbers duplicated within individual EntityLogs and those duplicated across multiple EntityLogs.

    Default versions of its methods are implemented in a protocol extension.

    The default methods print alerts to the console specific to each type of duplicate.

    Note

    Note The protocol has not been made generic for reasons of legibility of intent. However it could easily be fully decoupled from Clarity should the need arise – generic placeholders would be needed for EntityLog, EntityLog.Message and EntityLog.Code.

    Alternatively the dictionary of EntityCodes keyed by duplicate print number could be compiled by MessageCollator and passed as an argument to detectDuplicatePrintNumbersAcrossEntityLogs(_ :suppressAlert:)->(Bool,[Int:[String]]) with a rewritten method signature. This would also require exposure of the default protocol ‘duplicate type 2’ print alert methods.

    See more

    Declaration

    Swift

    protocol DuplicatePrintNumberIdentifiable : UsedPrintNumberIdentifiable
  • A protocol that groups methods involved in the compilation of lists of the print numbers being used as arguments to Clarity print statements in a client application.

    Default versions of the methods are implemented in a protocol extension.

    See more

    Declaration

    Swift

    protocol UsedPrintNumberIdentifiable
  • A protocol that groups print logic helper methods for use by ClarityPrintLogic in its single method that calculates, formats and prints messages to the console.

    Default versions of the helper methods are implemented in a protocol extension.

    See more

    Declaration

    Swift

    protocol ClarityPrintHelper