Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] Onboarding 화면 PinLayout 리팩토링 #51

Open
ChoiysApple opened this issue Jul 8, 2024 · 1 comment
Open

[Refactor] Onboarding 화면 PinLayout 리팩토링 #51

ChoiysApple opened this issue Jul 8, 2024 · 1 comment
Assignees
Labels
♻️ Refactor 리팩토링 wont fix 나중에 처리할 작업

Comments

@ChoiysApple
Copy link
Member

ChoiysApple commented Jul 8, 2024

Describe

  • Snapkit으로 개발되어 있는 레이아웃을, PinLayout + FlexLayout으로 리팩토링
  • 이후 개발되는 화면은 모두 PinLayout + FlexLayout으로 개발

Existing

    // TODO: [OMLK-17] PinLayout + FlexLayout으로 리팩토링
    func configureConstraints(for view: UIView) {
        
        carouselCollectionView.snp.makeConstraints { make in
            make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(85)
            make.leading.trailing.equalToSuperview()
        }
        
        pageControl.snp.makeConstraints { make in
            make.top.lessThanOrEqualTo(carouselCollectionView.snp.bottom).offset(40)
            make.centerX.equalToSuperview()
            make.bottom.equalTo(bottomButton.snp.top).offset(-56)
        }
        
        bottomButton.snp.makeConstraints { make in
            make.leading.trailing.equalToSuperview().inset(16)
            make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom).inset(12)
            make.height.equalTo(55)
        }
    }
    // TODO: [OMLK-17] PinLayout + FlexLayout으로 리팩토링
    private func setUpLayout() {
        
        self.addSubview(imageView)
        imageView.snp.makeConstraints { make in
            make.top.equalToSuperview()
            make.leading.trailing.equalToSuperview().inset(24)
            make.height.lessThanOrEqualTo(333)
        }
        
        let labelStack = UIStackView().then { stackView in
            stackView.axis = .vertical
            stackView.alignment = .center
            stackView.spacing = 8
        }
        
        self.addSubview(labelStack)
        labelStack.snp.makeConstraints { make in
            make.top.equalTo(imageView.snp.bottom).offset(46)
            make.leading.trailing.equalToSuperview()
            make.bottom.lessThanOrEqualToSuperview()
        }
        
        [titleLabel, descriptionLabel].forEach { label in
            labelStack.addArrangedSubview(label)
        }
    }

Benefits

  • 코드 성능 향상

Reference

Related

@ChoiysApple
Copy link
Member Author

개발 일정이 충분하지 않아, 1차 출시 이후 리팩토링 예정

@ChoiysApple ChoiysApple added this to the 1차 리팩토링 milestone Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
♻️ Refactor 리팩토링 wont fix 나중에 처리할 작업
Projects
None yet
Development

No branches or pull requests

1 participant