@@ -17,8 +17,8 @@ class HomeViewController: UIViewController {
1717 } ( )
1818
1919 override func viewDidLoad( ) {
20- navigationItem . title = " Finance App 💰 "
21- navigationController ? . navigationBar . prefersLargeTitles = true
20+ customNavBar ( )
21+ profilePictureNavBar ( )
2222
2323 service. fetchHomeData { homeData in
2424 guard let homeData = homeData else {
@@ -36,4 +36,23 @@ class HomeViewController: UIViewController {
3636 override func loadView( ) {
3737 self . view = homeView
3838 }
39+
40+ private func customNavBar( ) {
41+ let configNavBar = UINavigationBarAppearance ( )
42+ configNavBar. backgroundColor = UIColor . systemBackground
43+ navigationController? . navigationBar. standardAppearance = configNavBar
44+ navigationController? . navigationBar. scrollEdgeAppearance = configNavBar
45+ }
46+
47+ private func profilePictureNavBar( ) {
48+ let profilePicture = UIView ( frame: CGRect ( x: 0 , y: 0 , width: 40 , height: 40 ) )
49+ let image = UIImageView ( frame: CGRect ( x: 0 , y: 0 , width: 40 , height: 40 ) )
50+ image. image = UIImage ( named: " avatar-placeholder " )
51+ image. contentMode = . scaleAspectFit
52+ image. layer. cornerRadius = 22.5
53+ image. layer. masksToBounds = true
54+ profilePicture. addSubview ( image)
55+ let rightBarButton = UIBarButtonItem ( customView: profilePicture)
56+ navigationItem. rightBarButtonItem = rightBarButton
57+ }
3958}
0 commit comments