-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix/#28] Onboarding - baseViewController 파일 이슈 해결
- Loading branch information
1 parent
8725824
commit a24d0a9
Showing
4 changed files
with
163 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
HMH_iOS/HMH_iOS/Presentation/Onboarding/ViewControllers/OnboardingBaseViewController.swift
This file was deleted.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
HMH_iOS/HMH_iOS/Presentation/Onboarding/ViewControllers/OnboardingBaseViewControllers.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// | ||
// OnboardingBaseViewController.swift | ||
// HMH_iOS | ||
// | ||
// Created by Seonwoo Kim on 1/8/24. | ||
// | ||
|
||
import UIKit | ||
|
||
import SnapKit | ||
import Then | ||
|
||
protocol HomeViewPushDelegate: AnyObject { | ||
func didTapButton() | ||
} | ||
|
||
class OnboardingBaseViewController: UIViewController { | ||
weak var delegate: HomeViewPushDelegate? | ||
|
||
let navigationBar = HMHNavigationBar(leftItem: .normal, isBackButton: true, isTitleLabel: false, isPointImage: false) | ||
let progressBar = OnboardingProgressView(progressAmount: 2) | ||
private let nextButton = OnboardingButton(buttonStatus: .enabled, buttonText: "완료") | ||
|
||
override func viewWillAppear(_ animated: Bool) { | ||
super.viewWillAppear(animated) | ||
self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false | ||
self.navigationController?.navigationBar.isHidden = true | ||
} | ||
|
||
override func viewDidAppear(_ animated: Bool) { | ||
super.viewDidAppear(animated) | ||
progressBar.setProgressBar() | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
setUI() | ||
setTarget() | ||
} | ||
|
||
private func setUI() { | ||
setHierarchy() | ||
setConstraints() | ||
} | ||
|
||
func setHierarchy() { | ||
view.addSubviews(navigationBar, progressBar, nextButton) | ||
} | ||
func setConstraints() { | ||
navigationBar.snp.makeConstraints { | ||
$0.top.trailing.leading.equalToSuperview() | ||
$0.height.equalTo(113) | ||
} | ||
|
||
progressBar.snp.makeConstraints { | ||
$0.top.equalTo(navigationBar.snp.bottom) | ||
$0.trailing.leading.equalToSuperview().inset(20) | ||
} | ||
|
||
nextButton.snp.makeConstraints { | ||
$0.bottom.equalTo(view.safeAreaLayoutGuide).offset(-21) | ||
$0.leading.trailing.equalToSuperview().inset(20) | ||
} | ||
} | ||
|
||
func setTarget() { | ||
nextButton.addTarget(self, action: #selector(onTapButton), for: .touchUpInside) | ||
} | ||
|
||
@objc | ||
func onTapButton() { | ||
print("taptaptap") | ||
self.delegate?.didTapButton() | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters