Skip to content

//ios-sdk/SmartWallBuilder

CLASS

SmartWallBuilder

@objc public class SmartWallBuilder: NSObject

Swift

Example

let smartWall = try? SmartWallBuilder()
.setApiKey(apiKey: "YOUR-API-KEY")
.setSmartwallUid(smartwallUid: "YOUR-WALL-ID")
.setCustomVariables(variables: [
 "var1": 1,
 "var2": true,
])
.build()

Objective-C

Example

NSError * _Nullable e;
SmartWallBuilder *builder = [[SmartWallBuilder alloc]init];

builder = [builder setApiKeyWithApiKey:@"YOUR-API-KEY"];
builder = [builder setSmartwallUidWithSmartwallUid:@"YOUR-WALL-ID"];
builder = [builder setCustomVariablesWithDictionary:@{
 @"var1" : @"Hello, World!",
 @"var2" : true,
}];

SmartWall *smartWall= [builder buildAndReturnError:&e];

Methods

init()

public override init()

setApiKey(apiKey:)

@objc public func setApiKey(apiKey: String) -> SmartWallBuilder
  • Parameter apiKey: The smartwall organization Api Key.
  • Returns: A SmartWallBuilder instance`.

Parameters

Name Description
apiKey The smartwall organization Api Key.

setSmartwallUid(smartwallUid:)

@objc public func setSmartwallUid(smartwallUid: String) -> SmartWallBuilder
  • Parameter smartwallUid: The smartwall unique identifier.
  • Returns: A SmartWallBuilder instance`.

Parameters

Name Description
smartwallUid The smartwall unique identifier.

setUserId(userId:)

@objc public func setUserId(userId: String) -> SmartWallBuilder
  • Parameter userId: The user id from external system
  • Note: If it's not specified - device-based id is used by the sdk.
  • Returns: A SmartWallBuilder instance`.

Parameters

Name Description
userId The user id from external system

setCustomVariables(variables:)

public func setCustomVariables(variables: [String: AnyEncodable]) -> SmartWallBuilder

Variables which could be used in "Audience Segments" in the SmartWall dashboard. - Note only [String], [Int] and [Boolean] are supported as pair's values by SDK. - Parameter A dictionary with json valid values - Returns: A SmartWallBuilder instance`.

Parameters

Name Description
A dictionary with json valid values

setCustomVariables(dictionary:)

Variables which could be used in "Audience Segments" in the SmartWall dashboard. - Note only [String], [Int] and [Boolean] are supported as pair's values by SDK. - Parameter dictionary:A key value dictionary - Returns: A SmartWallBuilder instance`.

setLanguage(language:)

@objc public func setLanguage(language: String) -> SmartWallBuilder
  • Parameter language: Language code
  • Note: See https://doc.smartwall.ai/integrations/frontend/#language for supported language
  • Returns: A SmartWallBuilder instance`.

Parameters

Name Description
language Language code

build()

@objc public func build() throws -> SmartWall

Build the smartwall instance with the required parameters - Throws: A missing parameters error - Precondition: apiKey & apiKey must be set - Returns: A SmartWall instance.