Skip to content

Commit 119fe2b

Browse files
committed
[app] hide the last tab cell separator
1 parent 911eff3 commit 119fe2b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

NewTerm/UI/TopBar/TabCollectionViewCell.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ class TabCollectionViewCell: UICollectionViewCell {
1414

1515
let textLabel = UILabel()
1616
let closeButton = UIButton()
17+
let separatorView = UIView()
1718

1819
var separatorViewWidthConstraint: NSLayoutConstraint!
1920

21+
var isLastItem: Bool {
22+
get { return separatorView.isHidden }
23+
set { separatorView.isHidden = newValue }
24+
}
25+
2026
override init(frame: CGRect) {
2127
super.init(frame: frame)
2228

@@ -37,15 +43,14 @@ class TabCollectionViewCell: UICollectionViewCell {
3743
closeButton.alpha = 0.5
3844
contentView.addSubview(closeButton)
3945

40-
let separatorView = UIView()
4146
separatorView.translatesAutoresizingMaskIntoConstraints = false
4247
separatorView.backgroundColor = UIColor(white: 85 / 255, alpha: 0.4)
4348
contentView.addSubview(separatorView)
4449

4550
contentView.addCompactConstraints([
4651
"textLabel.centerY = contentView.centerY",
4752
"textLabel.left = contentView.left + 6",
48-
"closeButton.width = 24",
53+
"closeButton.width = 30",
4954
"closeButton.height = contentView.height",
5055
"closeButton.left = textLabel.right",
5156
"closeButton.right = contentView.right",

NewTerm/ViewControllers/RootViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ extension RootViewController: UICollectionViewDataSource, UICollectionViewDelega
191191
cell.isSelected = selectedTabIndex == indexPath.row
192192
cell.closeButton.tag = indexPath.row
193193
cell.closeButton.addTarget(self, action: #selector(self.removeTerminalButtonTapped(_:)), for: .touchUpInside)
194+
cell.isLastItem = indexPath.row == terminals.count - 1
194195
return cell
195196
}
196197

0 commit comments

Comments
 (0)