Skip to content

Commit 9e8be06

Browse files
committed
adicionando tabbar
1 parent ad41c6e commit 9e8be06

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

solutions/devsprint-caio-santos-7/FinanceApp.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
25C8174B28F608BF003127C0 /* AccountSummaryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25C8174A28F608BF003127C0 /* AccountSummaryView.swift */; };
1212
25C8174D28F60A0C003127C0 /* ViewCodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25C8174C28F60A0C003127C0 /* ViewCodable.swift */; };
1313
25C8175528F772FD003127C0 /* AccountSummaryViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25C8175428F772FD003127C0 /* AccountSummaryViewTests.swift */; };
14+
812318DA28F8CAB300B05425 /* TabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 812318D928F8CAB300B05425 /* TabBarController.swift */; };
1415
98584A6D277E32C30028DBEA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98584A6C277E32C30028DBEA /* AppDelegate.swift */; };
1516
98584A6F277E32C30028DBEA /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98584A6E277E32C30028DBEA /* SceneDelegate.swift */; };
1617
98584A76277E32C50028DBEA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 98584A75277E32C50028DBEA /* Assets.xcassets */; };
@@ -68,6 +69,7 @@
6869
55C4E25CA63BCFCC105EC051 /* Pods_FinanceApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FinanceApp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6970
61A71CDF7B0095F152A3CD4E /* Pods-FinanceApp-FinanceAppUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FinanceApp-FinanceAppUITests.debug.xcconfig"; path = "Target Support Files/Pods-FinanceApp-FinanceAppUITests/Pods-FinanceApp-FinanceAppUITests.debug.xcconfig"; sourceTree = "<group>"; };
7071
6989344458FFDBA154C3EC32 /* Pods-FinanceApp-FinanceAppUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FinanceApp-FinanceAppUITests.release.xcconfig"; path = "Target Support Files/Pods-FinanceApp-FinanceAppUITests/Pods-FinanceApp-FinanceAppUITests.release.xcconfig"; sourceTree = "<group>"; };
72+
812318D928F8CAB300B05425 /* TabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarController.swift; sourceTree = "<group>"; };
7173
98584A69277E32C30028DBEA /* FinanceApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FinanceApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
7274
98584A6C277E32C30028DBEA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7375
98584A6E277E32C30028DBEA /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
@@ -233,6 +235,7 @@
233235
children = (
234236
98584A6C277E32C30028DBEA /* AppDelegate.swift */,
235237
98584A6E277E32C30028DBEA /* SceneDelegate.swift */,
238+
812318D928F8CAB300B05425 /* TabBarController.swift */,
236239
);
237240
path = AppDelegate;
238241
sourceTree = "<group>";
@@ -573,6 +576,7 @@
573576
buildActionMask = 2147483647;
574577
files = (
575578
25C8174D28F60A0C003127C0 /* ViewCodable.swift in Sources */,
579+
812318DA28F8CAB300B05425 /* TabBarController.swift in Sources */,
576580
98584AC3277E42E80028DBEA /* FinanceService.swift in Sources */,
577581
25C8174B28F608BF003127C0 /* AccountSummaryView.swift in Sources */,
578582
98584B10277E605F0028DBEA /* ActivityDetailsViewController.swift in Sources */,

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

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

1919
self.window = UIWindow(frame: UIScreen.main.bounds)
20-
self.window?.rootViewController = UINavigationController(rootViewController: HomeViewController())
20+
self.window?.rootViewController = UINavigationController(rootViewController: TabBarViewController())
2121
self.window?.windowScene = windowScene
2222
self.window?.makeKeyAndVisible()
2323
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// TabBarController.swift
3+
// FinanceApp
4+
//
5+
// Created by Vinicius on 13/10/22.
6+
//
7+
8+
import Foundation
9+
import UIKit
10+
11+
class TabBarViewController: UITabBarController, UITabBarControllerDelegate {
12+
13+
override func viewDidLoad() {
14+
super.viewDidLoad()
15+
16+
// Atribuir delegate para que a VC utilize os metodos do delegate
17+
self.delegate = self
18+
}
19+
20+
override func viewWillAppear(_ animated: Bool) {
21+
super.viewWillAppear(animated)
22+
23+
//Criação da primeira tab
24+
let tabHome = HomeViewController()
25+
let tabHomeBarItem = UITabBarItem(title: "Home", image: UIImage(systemName: "house.fill"), selectedImage: nil)
26+
27+
tabHome.tabBarItem = tabHomeBarItem
28+
29+
//Criacao da segunda tab
30+
let tabTransfers = TransfersViewController()
31+
let tabTransfersBarItem = UITabBarItem(title: "Transfers", image: UIImage(systemName: "arrow.up.arrow.down"), selectedImage: nil)
32+
33+
tabTransfers.tabBarItem = tabTransfersBarItem
34+
35+
self.viewControllers = [tabHome, tabTransfers]
36+
37+
}
38+
func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
39+
40+
}
41+
42+
43+
44+
}

0 commit comments

Comments
 (0)