YAPP-Github / 24th-App-Team-3-iOS

7 stars 0 forks source link

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

Open ChoiysApple opened 4 months ago

ChoiysApple commented 4 months ago

Describe

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 commented 4 months ago

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