Skip to content

Commit a5b522c

Browse files
committed
Ajustes PR.
1 parent 5882719 commit a5b522c

File tree

5 files changed

+39
-17
lines changed

5 files changed

+39
-17
lines changed

solutions/devsprint-caio-santos-7/FinanceApp/AppDelegate/SceneDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
1515
guard let windowScene = (scene as? UIWindowScene) else { return }
1616

1717
self.window = UIWindow(frame: UIScreen.main.bounds)
18-
self.window?.rootViewController = TransfersViewController()
18+
self.window?.rootViewController = TabBarViewController()
1919
self.window?.windowScene = windowScene
2020
self.window?.makeKeyAndVisible()
2121
}

solutions/devsprint-caio-santos-7/FinanceApp/AppDelegate/TabBarController.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ class TabBarViewController: UITabBarController, UITabBarControllerDelegate {
1414

1515
// Atribuir delegate para que a VC utilize os metodos do delegate
1616
self.delegate = self
17+
18+
let lineView = UIView(frame: CGRect(x: 0, y: 0, width: tabBar.frame.size.width, height: 0.5))
19+
lineView.backgroundColor = UIColor.systemGray
20+
tabBar.addSubview(lineView)
1721
}
1822

1923
override func viewWillAppear(_ animated: Bool) {

solutions/devsprint-caio-santos-7/FinanceApp/Screens/Transfers/TransfersView.swift

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ class TransfersView: UIView {
1212
private lazy var stackViewPrincipal: UIStackView = {
1313
let sv = UIStackView()
1414
sv.translatesAutoresizingMaskIntoConstraints = false
15-
sv.alignment = .center
1615
sv.spacing = 10
1716
sv.axis = .vertical
17+
sv.distribution = .fill
1818
return sv
1919
}()
2020

@@ -27,7 +27,6 @@ class TransfersView: UIView {
2727
return sv
2828
}()
2929

30-
3130
lazy var centerLabel: UITextField = {
3231
var input = UITextField()
3332
input.translatesAutoresizingMaskIntoConstraints = false
@@ -37,6 +36,7 @@ class TransfersView: UIView {
3736
string: "$0",
3837
attributes: [NSAttributedString.Key.foregroundColor: UIColor(red: 0.235, green: 0.235, blue: 0.263, alpha: 0.6)]
3938
)
39+
input.textAlignment = .center
4040

4141
return input
4242
}()
@@ -95,17 +95,19 @@ class TransfersView: UIView {
9595
stackViewSec.addArrangedSubview(buttonContact)
9696
buttonContact.addSubview(iconGreen)
9797
addSubview(buttonTransfer)
98-
99-
10098
}
10199

102100
required init?(coder: NSCoder) {
103101
fatalError("init(coder:) has not been implemented")
104102
}
105103

106104
private func setUpContraints(){
105+
let lg = safeAreaLayoutGuide
106+
107107
NSLayoutConstraint.activate([
108-
108+
stackViewPrincipal.centerYAnchor.constraint(equalTo: lg.centerYAnchor),
109+
stackViewPrincipal.centerXAnchor.constraint(equalTo: lg.centerXAnchor),
110+
109111
iconGreen.widthAnchor.constraint(equalToConstant: 10),
110112
iconGreen.heightAnchor.constraint(equalToConstant: 10),
111113
iconGreen.centerYAnchor.constraint(equalTo: buttonContact.centerYAnchor),
@@ -114,18 +116,10 @@ class TransfersView: UIView {
114116
buttonContact.widthAnchor.constraint(equalToConstant: 135),
115117
buttonContact.heightAnchor.constraint(equalToConstant: 30),
116118

117-
stackViewPrincipal.centerYAnchor.constraint(equalTo: safeAreaLayoutGuide.centerYAnchor),
118-
stackViewPrincipal.centerXAnchor.constraint(equalTo: safeAreaLayoutGuide.centerXAnchor),
119-
120-
121-
122-
buttonTransfer.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor, constant: -45),
119+
buttonTransfer.bottomAnchor.constraint(equalTo: lg.bottomAnchor, constant: -16),
123120
buttonTransfer.heightAnchor.constraint(equalToConstant: 45),
124-
buttonTransfer.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor, constant: 45),
125-
buttonTransfer.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor, constant: -45),
126-
127-
128-
121+
buttonTransfer.leadingAnchor.constraint(equalTo: lg.leadingAnchor, constant: 45),
122+
buttonTransfer.trailingAnchor.constraint(equalTo: lg.trailingAnchor, constant: -45)
129123
])
130124
}
131125

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// TransfersViewTests.swift
3+
// FinanceAppTests
4+
//
5+
// Created by Caio Santos on 20/10/22.
6+
//
7+
8+
@testable import FinanceApp
9+
import SnapshotTesting
10+
import XCTest
11+
12+
final class TransfersViewTests: XCTestCase {
13+
14+
override class func setUp() {
15+
// SnapshotTesting.isRecording = true
16+
}
17+
18+
func testRenderView() {
19+
let component = TransfersView()
20+
component.backgroundColor = .white
21+
assertSnapshot(matching: component, as: .image(size: CGSize(width: UIScreen.main.bounds.width,
22+
height: UIScreen.main.bounds.height)))
23+
}
24+
}
42.6 KB
Loading

0 commit comments

Comments
 (0)