---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://ads.yandex.com/helpcenter/en/dev/ios7/template.md
  - https://ads.yandex.com/helpcenter/ru/dev/ios7/template.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ads.yandex.com/helpcenter/ru/llms.txt

<!--
Используется в Boost: boost/ru/ad-monetization/dev/ios
-->

# Настройка внешнего оформления с помощью шаблона

Для настройки внешнего оформления можно использовать стандартный шаблон оформления. Шаблон содержит набор предустановленных настроек для всех визуальных компонентов рекламы, но при этом их можно кастомизировать. 

{% cut "Пример кода" %}

```swift
let bannerView = NativeBannerView()
bannerView.ad = ad
view.addSubview(bannerView)

let appearance = MutableNativeTemplateAppearance.default()

let orangeColor = UIColor(red: 1, green: 176.0/255, blue: 32.0/255, alpha: 1)
let blueColor = UIColor(red: 0, green: 170.0/255, blue: 1, alpha: 1)


appearance.borderColor = orangeColor

let ratingAppearance = appearance.ratingAppearance?.mutableCopy() as? MutableRatingAppearance
ratingAppearance?.filledStarColor = orangeColor
appearance.ratingAppearance = ratingAppearance

let callToActionTextAppearance = LabelAppearance(font: .systemFont(ofSize: 14), textColor: blueColor)

let callToActionAppearance = ButtonAppearance(
    textAppearance: callToActionTextAppearance,
    normalColor: .clear,
    highlightedColor: .gray,
    borderColor: blueColor,
    borderWidth: 1
)
appearance.callToActionAppearance = callToActionAppearance
appearance.ageAppearance = LabelAppearance(font: .systemFont(ofSize: 12), textColor: .gray)
appearance.titleAppearance = LabelAppearance(font: .systemFont(ofSize: 14), textColor: .black)
appearance.bodyAppearance = LabelAppearance(font: .systemFont(ofSize: 12), textColor: .gray)

let imageConstraint = SizeConstraint(type: .fixed, value: 60)
appearance.imageAppearance = ImageAppearance(widthConstraint: imageConstraint)
bannerView.apply(appearance)

```

{% endcut %}

{% note info %}

При создании своего оформления на основе шаблона необязательно задавать предпочитаемые настройки для всех визуальных компонентов. Компоненты, для которых не установлены предпочитаемые настройки, будут сконфигурированы значениями по умолчанию.

{% endnote %}
