Skip to content

Commit 4f6bfec

Browse files
author
Giorgio Ruscigno
committed
Update MigrationWelcomeViewController, restore layout margins and header
1 parent f9f2a20 commit 4f6bfec

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Welcome/MigrationWelcomeViewController.swift

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ final class MigrationWelcomeViewController: UIViewController {
1313
private lazy var headerView: MigrationHeaderView = {
1414
let view = MigrationHeaderView(configuration: viewModel.configuration.headerConfiguration)
1515
view.translatesAutoresizingMaskIntoConstraints = true
16+
view.directionalLayoutMargins = Constants.tableHeaderViewMargins
1617
return view
1718
}()
1819

@@ -57,25 +58,10 @@ final class MigrationWelcomeViewController: UIViewController {
5758
self.tableView.register(MigrationWelcomeBlogTableViewCell.self, forCellReuseIdentifier: MigrationWelcomeBlogTableViewCell.defaultReuseID)
5859
self.tableView.translatesAutoresizingMaskIntoConstraints = false
5960
self.tableView.dataSource = self
61+
self.tableView.tableHeaderView = headerView
6062
self.tableView.cellLayoutMarginsFollowReadableWidth = true
6163
self.view.addSubview(tableView)
6264
self.view.pinSubviewToAllEdges(tableView)
63-
setupHeader()
64-
}
65-
66-
private func setupHeader() {
67-
let headerContentView = UIView()
68-
headerContentView.translatesAutoresizingMaskIntoConstraints = false
69-
headerView.translatesAutoresizingMaskIntoConstraints = false
70-
headerContentView.addSubview(headerView)
71-
headerContentView.pinSubviewToAllEdges(headerView, insets: Constants.tableHeaderViewMargins)
72-
self.tableView.tableHeaderView = headerContentView
73-
NSLayoutConstraint.activate([
74-
headerContentView.centerXAnchor.constraint(equalTo: tableView.centerXAnchor),
75-
headerContentView.topAnchor.constraint(equalTo: tableView.topAnchor),
76-
headerContentView.widthAnchor.constraint(equalTo: tableView.widthAnchor)
77-
])
78-
7965
}
8066

8167
private func setupNavigationBar() {
@@ -108,7 +94,7 @@ final class MigrationWelcomeViewController: UIViewController {
10894
static let tableViewLeadingMargin = CGFloat(30)
10995

11096
/// Used for the `tableHeaderView` layout guide margins.
111-
static let tableHeaderViewMargins = UIEdgeInsets(top: 0, left: 30, bottom: 30, right: 30)
97+
static let tableHeaderViewMargins = NSDirectionalEdgeInsets(top: 0, leading: 30, bottom: 30, trailing: 30)
11298
}
11399
}
114100

0 commit comments

Comments
 (0)