Collection

public extension Collection where Element: MoEngageModuleInfo
public extension Collection where Element == MoEngageModule.Info

Available where Element: MoEngageModuleInfo

  • Convert module infos into payload to be sent.

    Declaration

    Swift

    var payload: [String : String] { get }

Available where Element == MoEngageModule.Info

  • Converts module information into a payload suitable for network transmission.

    This creates a dictionary mapping module names to their versions, plus the app’s version under the “app” key. This format is used when reporting active modules to the MoEngage backend.

    Payload Format

    {
      "app": "1.2.3",
      "messaging": "2.0.0",
      "inApp": "1.5.0",
      "cards": "1.0.0"
    }
    

    Duplicate Names

    If multiple modules have the same name, the last one wins. This is by design to prefer the most recently registered module.

    Example

    let modules: [MoEngageModule.Info] = [
        .init(name: "messaging", version: "2.0.0"),
        .init(name: "inApp", version: "1.5.0")
    ]
    let payload = modules.payload
    // ["app": "1.2.3", "messaging": "2.0.0", "inApp": "1.5.0"]
    

    Declaration

    Swift

    var payload: [String : String] { get }

    Return Value

    Dictionary mapping module names to versions, plus app version