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.
-
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
dictDictionary containing rule configuration. Expected format: {“max”: 3, “unit”: “day”, “period”: 2} Returns nil if required data is missing
-
Initializes a frequency capping rule from a decoder.
Throws
Decoding errors if the data is malformed.Declaration
Swift
public required init(from decoder: Decoder) throwsParameters
decoderThe 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) throwsParameters
encoderThe encoder to write data to.
-
Initializes a frequency capping rule from an NSCoder for unarchiving.
Declaration
Swift
public required init?(coder: NSCoder)Parameters
coderThe 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
coderThe coder to use for archiving.