diff --git a/iOS/airbnb.xcodeproj/project.pbxproj b/iOS/airbnb.xcodeproj/project.pbxproj index a02b7a8b4..120ef048c 100644 --- a/iOS/airbnb.xcodeproj/project.pbxproj +++ b/iOS/airbnb.xcodeproj/project.pbxproj @@ -25,6 +25,7 @@ D00B74502851D1D700B31424 /* WeekdayCollectionViewDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00B744F2851D1D700B31424 /* WeekdayCollectionViewDataSource.swift */; }; D00B74532851E80600B31424 /* WeekdayModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00B74522851E80600B31424 /* WeekdayModel.swift */; }; D00B74552851E80D00B31424 /* CalendarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00B74542851E80D00B31424 /* CalendarModel.swift */; }; + D00B745C28521E8F00B31424 /* UIViewController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00B745B28521E8F00B31424 /* UIViewController+Extension.swift */; }; D01D65EF283C70710067B5E1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D01D65EE283C70710067B5E1 /* AppDelegate.swift */; }; D01D65F1283C70710067B5E1 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D01D65F0283C70710067B5E1 /* SceneDelegate.swift */; }; D01D65F3283C70710067B5E1 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D01D65F2283C70710067B5E1 /* MainViewController.swift */; }; @@ -119,6 +120,7 @@ D00B744F2851D1D700B31424 /* WeekdayCollectionViewDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeekdayCollectionViewDataSource.swift; sourceTree = ""; }; D00B74522851E80600B31424 /* WeekdayModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeekdayModel.swift; sourceTree = ""; }; D00B74542851E80D00B31424 /* CalendarModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarModel.swift; sourceTree = ""; }; + D00B745B28521E8F00B31424 /* UIViewController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extension.swift"; sourceTree = ""; }; D01D65EB283C70710067B5E1 /* airbnb.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = airbnb.app; sourceTree = BUILT_PRODUCTS_DIR; }; D01D65EE283C70710067B5E1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; D01D65F0283C70710067B5E1 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -367,6 +369,7 @@ isa = PBXGroup; children = ( D01D6630283D3A200067B5E1 /* UIColor+Extension.swift */, + D00B745B28521E8F00B31424 /* UIViewController+Extension.swift */, ); path = Extension; sourceTree = ""; @@ -784,6 +787,7 @@ D0CC2B6E2840733200D77A3E /* MainFlowCoordinator.swift in Sources */, D00B744528519F1100B31424 /* CustomColor.swift in Sources */, D01D6631283D3A200067B5E1 /* UIColor+Extension.swift in Sources */, + D00B745C28521E8F00B31424 /* UIViewController+Extension.swift in Sources */, D0D29A25284FBDC5009D1608 /* WishListModel.swift in Sources */, D0D29A2D284FCF00009D1608 /* ReservationCollectionViewDataSource.swift in Sources */, D089E7DE2844D2450000AE78 /* NearestDestinationCollectionViewCell.swift in Sources */, diff --git a/iOS/airbnb/Common/Extension/UIViewController+Extension.swift b/iOS/airbnb/Common/Extension/UIViewController+Extension.swift new file mode 100644 index 000000000..275040019 --- /dev/null +++ b/iOS/airbnb/Common/Extension/UIViewController+Extension.swift @@ -0,0 +1,19 @@ +// +// UIViewController+Extension.swift +// airbnb +// +// Created by 안상희 on 2022/06/09. +// + +import UIKit + +extension UIViewController { + func alert(title: String, message: String) { + let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) + + let okAction = UIAlertAction(title: "확인", style: .default, handler: nil) + alert.addAction(okAction) + + present(alert, animated: true, completion: nil) + } +} diff --git a/iOS/airbnb/Present/Main/MainViewController.swift b/iOS/airbnb/Present/Main/MainViewController.swift index 27dbdb507..e65681502 100644 --- a/iOS/airbnb/Present/Main/MainViewController.swift +++ b/iOS/airbnb/Present/Main/MainViewController.swift @@ -17,6 +17,18 @@ final class MainViewController: UIViewController { private var mainCollectionView: UICollectionView! = nil private var dataSource: MainSectionDiffableDataSource! + private lazy var loginButton: UIBarButtonItem = { + let button = UIBarButtonItem(title: "로그인", + style: .plain, + target: self, + action: #selector(loginButtonTapped(_:))) + return button + }() + + @objc private func loginButtonTapped(_ sender: Any) { + alert(title: "알림", message: "로그인 되었습니다.") + } + override func viewDidLoad() { super.viewDidLoad() @@ -41,6 +53,7 @@ final class MainViewController: UIViewController { self.navigationItem.title = "Airbnb" self.navigationItem.searchController = searchController + self.navigationItem.rightBarButtonItem = loginButton } private func configureCollectionView() {