iOS SDK customization

With the iOS SDK, you can set your own customization for:

Theme

The theme allows you to customize things, such as fonts, colors and images used across SDK. The default theme is accessible once the SDK is initialized. So, depending on your needs, you either adjust the theme in place.

sdk.theme.colors.backgroundCommon = .white

or inherit from SNSTheme and apply your own theme at once.

sdk.theme = OwnTheme()

class OwnTheme: SNSTheme {
    override init() {
        super.init()

        colors.backgroundCommon = .white
    }
}

See iOS Theme API and iOS Theme guide for details.

Font adjustments

By default, font sizes are automatically adjusted to respect the user's preference for Text Size.

When the SDK is presented, it takes the user-selected Text Size by reading from preferredContentSizeCategory and adjusts the fonts accordingly. However, it won't reflect any changes made while the SDK is running until the next run.

The maximum supported content category size is .extraExtraExtraLarge at the moment.

You can opt out of the automatic font adjustments described above if it's not appropriate for some reasons:

sdk.theme.metrics.respectsPreferredContentSizeCategory = false

Localization

You can customize or localize the texts used within the SDK through the MSDK Translations tool in the dashboard.

The language of the texts will be set according to the system locale, but you could override it by setting sdk.locale to the locale you desire. Use the values in a form of en or en_US.

sdk.locale = Locale.current.identifier

Check the list of supported locales by SDK here.

Strings

In addition to the MSDK Translations tool and sdk.locale, you can use the sdk.strings dictionary that allows you to define the strings locally. This could be helpful for example if you would like to avoid the Wordless Oops screen that could be rendered in case the network happens to be down during the SDK initialization and force the SDK to draw the Network Oops screen instead.

sdk.strings = [
  "sns_oops_network_title": "Oops! Seems like the network is down.",
  "sns_oops_network_html": "Please check your internet connection and try again.",
  "sns_oops_action_retry": "Try again",
]

Consider that sdk.locale does not affect these strings, thus it's up to you to use the required localization.

Support items

Support items define the ways, in which your applicants will be prompted to contact you at the Support screen.
Initially, an email item would be created automatically using the Support email configured in your dashboard.

Feel free to reconfigure support items as necessary. In order to do so, you can either assign an array of items to sdk.supportItems property directly, or use sdk.addSupportItem helper to add them one by one.

sdk.addSupportItem { (item) in
    item.title = NSLocalizedString("URL Item", comment: "")
    item.subtitle = NSLocalizedString("Tap me to open an url", comment: "")
    item.icon = UIImage(named: "AppIcon")
    item.actionURL = URL(string: "https://google.com")
}

sdk.addSupportItem { (item) in
    item.title = NSLocalizedString("Callback Item", comment: "")
    item.subtitle = NSLocalizedString("Tap me to get callback fired", comment: "")
    item.icon = UIImage(named: "AppIcon")
    item.actionHandler { (supportVC, item) in
        print("[\(item.title)] tapped")
    }
}

Each item must have a mandatory title, optional icon, subtitle and an action expressed with actionURL or actionHandler.

If actionHandler is defined, it would be called when the item is tapped, otherwise actionURL would be opened with UIApplication's openURL: method.

If no actionURL and no actionHandler are provided, then no action would be taken on tap.