IntroCompleteView.swift 2.04 KB
Newer Older
1
2
3
4
import PureLayout
import UIKit

class IntroCompleteView: UIView {
Olev Abel's avatar
Olev Abel committed
5
6
7
8
9
10
  private typealias SubLabelStyle = Style.General.Object.SubLabel
  private typealias HeaderLabelStyle = Style.General.Object.HeaderLabel
  private typealias LinkStyle = Style.General.Object.Link
  private typealias LocalStyle = Style.Screen.Onboarding
  private typealias LayoutStyle = Style.General.Layout
  private typealias Strings = L10n.Intro.Page3
11

Olev Abel's avatar
Olev Abel committed
12
13
  let titleLabel = UILabel()
  let subtitleLabel = UILabel()
14

Olev Abel's avatar
Olev Abel committed
15
16
17
18
19
  init() {
    super.init(frame: .zero)
    setup()
    layout()
  }
20

Olev Abel's avatar
Olev Abel committed
21
22
23
24
  @available(*, unavailable)
  required init?(coder _: NSCoder) {
    fatalError("init(coder:) has not been implemented")
  }
25

Olev Abel's avatar
Olev Abel committed
26
27
28
29
  private func setup() {
    titleLabel.attributedText = Strings.title.withAttributes(
      .alignment(.center),
      .color(.white),
30
      .font(.ainoHeadline(size: HeaderLabelStyle.FontSize.extraLarge))
Olev Abel's avatar
Olev Abel committed
31
32
    )
    titleLabel.accessibilityTraits = .header
33

Olev Abel's avatar
Olev Abel committed
34
35
36
    subtitleLabel.attributedText = Strings.subtitle.withAttributes(
      .alignment(.center),
      .color(.white),
37
      .font(.ainoHeadline(size: HeaderLabelStyle.FontSize.medium))
Olev Abel's avatar
Olev Abel committed
38
    )
39

Olev Abel's avatar
Olev Abel committed
40
    subtitleLabel.numberOfLines = 0
41

Olev Abel's avatar
Olev Abel committed
42
43
    backgroundColor = Asset.estonianBlue.color
  }
44

Olev Abel's avatar
Olev Abel committed
45
46
47
48
49
  private func layout() {
    addSubview(subtitleLabel)
    subtitleLabel.autoCenterInSuperview()
    subtitleLabel.autoPinEdge(toSuperviewEdge: .left)
    subtitleLabel.autoPinEdge(toSuperviewEdge: .right)
50

Olev Abel's avatar
Olev Abel committed
51
52
53
54
    addSubview(titleLabel)
    titleLabel.autoPinEdge(.bottom, to: .top, of: subtitleLabel, withOffset: LayoutStyle.Margin.negativeLarge)
    titleLabel.autoPinEdge(toSuperviewEdge: .left)
    titleLabel.autoPinEdge(toSuperviewEdge: .right)
55

Olev Abel's avatar
Olev Abel committed
56
57
58
    let footerImageView = UIImageView(image: Asset.illustration1.image)
    footerImageView.contentMode = .scaleAspectFit
    addSubview(footerImageView)
59

Olev Abel's avatar
Olev Abel committed
60
61
62
63
64
65
66
67
68
    footerImageView.autoPinEdgesToSuperviewEdges(with: .zero, excludingEdge: .top)
    footerImageView.autoPinEdge(
      .top,
      to: .bottom,
      of: subtitleLabel,
      withOffset: LocalStyle.FooterImage.offSet,
      relation: .greaterThanOrEqual
    )
  }
69
}