Skip to content

Commit

Permalink
Refactor [#269] Base 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
chaentopia committed Oct 25, 2023
1 parent 27b760b commit 155ad95
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ class BaseViewController: UIViewController, UIGestureRecognizerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.interactivePopGestureRecognizer?.delegate = self
setStyle()
setLayout()
setUI()
}

override func viewWillAppear(_ animated: Bool) {
Expand All @@ -46,6 +45,11 @@ class BaseViewController: UIViewController, UIGestureRecognizerDelegate {

// MARK: UI

func setUI() {
setStyle()
setLayout()
}

/// Attributes (속성) 설정 메서드
func setStyle() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ final class ProfileViewController: BaseViewController {

// MARK: - Function
// MARK: LifeCycle
override func viewDidLoad() {
super.viewDidLoad()
setDelegate()
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
Amplitude.instance().logEvent("view_profile")
Expand All @@ -42,15 +47,6 @@ final class ProfileViewController: BaseViewController {
self.paymentPlusViewController.getProducts()
}

override func setStyle() {
view.backgroundColor = .black
profileView.navigationBarView.delegate = self
profileView.handleFriendCellDelegate = self
friendProfileViewController.friendProfileView.handleDeleteFriendButtonDelegate = self
bottomSheetViewController.friendProfileView.handleDeleteFriendButtonDelegate = self
profileView.handleShopButton = self
}

override func setLayout() {

let tabbarHeight = 60 + safeAreaBottomInset()
Expand All @@ -69,6 +65,14 @@ final class ProfileViewController: BaseViewController {
}
}

func setDelegate() {
profileView.navigationBarView.delegate = self
profileView.handleFriendCellDelegate = self
friendProfileViewController.friendProfileView.handleDeleteFriendButtonDelegate = self
bottomSheetViewController.friendProfileView.handleDeleteFriendButtonDelegate = self
profileView.handleShopButton = self
}

func resetProfileView() {
self.profileView.pageCount = -1
self.profileView.isFinishPaging = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protocol HandleBackButtonDelegate: AnyObject {
func popView()
}

final class SettingNavigationBarView: UIView {
final class SettingNavigationBarView: BaseView {

// MARK: - Variables
// MARK: Property
Expand All @@ -24,30 +24,8 @@ final class SettingNavigationBarView: UIView {
// MARK: Component
lazy var backButton = UIButton()
let titleLabel = UILabel()

// MARK: - Function
// MARK: LifeCycle
override init(frame: CGRect) {
super.init(frame: frame)
setUI()
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

// MARK: - extension
extension SettingNavigationBarView {

// MARK: Layout Helpers
private func setUI() {
setStyle()
setLayout()
}

private func setStyle() {
override func setStyle() {
self.backgroundColor = .black

titleLabel.do {
Expand All @@ -63,7 +41,7 @@ extension SettingNavigationBarView {
}
}

private func setLayout() {
override func setLayout() {
self.addSubviews(backButton,
titleLabel)

Expand Down

0 comments on commit 155ad95

Please sign in to comment.