MoEngageInAppFCRule

@objcMembers
public class MoEngageInAppFCRule : MoEngageModelObject, NSCoding, Codable

A model class representing a frequency capping rule for in-app campaigns.

This class defines the parameters for frequency capping rules, including maximum display count, time unit, and period for the rule.

Key Features:

  • Maximum display count configuration
  • Time unit specification (session, hour, day)
  • Period duration for the rule
  • Validation and error handling

Frequency capping rule for in-app campaigns. Base class for tag-based and global rules.

Properties

  • max

    Maximum number of times the campaign can be displayed.

    • A positive value means limit to that number of displays

    Declaration

    Swift

    public let max: Int
  • Time unit for the frequency capping rule.

    Declaration

    Swift

    public let unit: MoEngageInAppFCUnit
  • Period duration for the rule (e.g., 1 hour, 2 days).

    Declaration

    Swift

    public let period: Int
  • Initializes a frequency capping rule from a dictionary.

    Declaration

    Swift

    public init?(dict: [String : Any]?)

    Parameters

    dict

    Dictionary containing rule configuration. Expected format: {“max”: 3, “unit”: “day”, “period”: 2} Returns nil if required data is missing

Codable

  • Initializes a frequency capping rule from a decoder.

    Throws

    Decoding errors if the data is malformed.

    Declaration

    Swift

    public required init(from decoder: Decoder) throws

    Parameters

    decoder

    The decoder to read data from.

  • Encodes a frequency capping rule to an encoder.

    Throws

    Encoding errors if the data cannot be encoded.

    Declaration

    Swift

    public func encode(to encoder: Encoder) throws

    Parameters

    encoder

    The encoder to write data to.

NSCoding

  • Initializes a frequency capping rule from an NSCoder for unarchiving.

    Declaration

    Swift

    public required init?(coder: NSCoder)

    Parameters

    coder

    The coder to use for unarchiving.

    Return Value

    An initialized frequency capping rule instance.

  • Encodes a frequency capping rule using NSCoder for archiving.

    Declaration

    Swift

    public func encode(with coder: NSCoder)

    Parameters

    coder

    The coder to use for archiving.