This article is not available in your language, so the default english version is displayed instead.
#Variables
Some texts inside the paywall benefit from predefined & automatically integrated variables, such as {app_name}
.
The .variable
function allows you to define custom variables, which can be used in all paywall texts.
#Usage
func variable(_ variables: [String: Any]) -> Void
example.swift
import AccessIOS
var access = Access(key: "<your app id>")
access.variables(["year": Calendar.current.component(.year, from: Date()) ])
access.texts(["subscription_desc": "Happy new year {year}! Take advantage of the New Year to discover our new offers!"])
let variables: [
"remaining": 1,
"total": 6
]
access.variables(variables)
access.texts(["gift_desc", "You have {remaining} article to read, out of {total}"]);