Skip to content

Commit

Permalink
feat: 로그인 버튼 클릭하면 알림창 나오도록 구현 (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
AhnSangHee committed Jun 9, 2022
1 parent fea14d7 commit a338a73
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions iOS/airbnb.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -119,6 +120,7 @@
D00B744F2851D1D700B31424 /* WeekdayCollectionViewDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeekdayCollectionViewDataSource.swift; sourceTree = "<group>"; };
D00B74522851E80600B31424 /* WeekdayModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeekdayModel.swift; sourceTree = "<group>"; };
D00B74542851E80D00B31424 /* CalendarModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarModel.swift; sourceTree = "<group>"; };
D00B745B28521E8F00B31424 /* UIViewController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extension.swift"; sourceTree = "<group>"; };
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 = "<group>"; };
D01D65F0283C70710067B5E1 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -367,6 +369,7 @@
isa = PBXGroup;
children = (
D01D6630283D3A200067B5E1 /* UIColor+Extension.swift */,
D00B745B28521E8F00B31424 /* UIViewController+Extension.swift */,
);
path = Extension;
sourceTree = "<group>";
Expand Down Expand Up @@ -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 */,
Expand Down
19 changes: 19 additions & 0 deletions iOS/airbnb/Common/Extension/UIViewController+Extension.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}
13 changes: 13 additions & 0 deletions iOS/airbnb/Present/Main/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -41,6 +53,7 @@ final class MainViewController: UIViewController {

self.navigationItem.title = "Airbnb"
self.navigationItem.searchController = searchController
self.navigationItem.rightBarButtonItem = loginButton
}

private func configureCollectionView() {
Expand Down

0 comments on commit a338a73

Please sign in to comment.