Skip to content

feat: LayoverConstraintWrapper 구현#50

Open
loinsir wants to merge 3 commits into
iOS/devfrom
iOS/feat#49
Open

feat: LayoverConstraintWrapper 구현#50
loinsir wants to merge 3 commits into
iOS/devfrom
iOS/feat#49

Conversation

@loinsir

@loinsir loinsir commented Nov 20, 2023

Copy link
Copy Markdown
Collaborator

🧑‍🚀 PR 요약

오토레이아웃을 편리하게 작성할 수 있는 extension wrapper를 구현했습니다.
완전 Snapkit...처럼은 아니지만 어느정도 컨셉은 비슷하게 ^^;; 구현해보려고 노력했습니다.
전부 다 구현한 건 아니고 필요한 메서드는 ConstraintMaker에 구현해주시면 될 것 같아요.
우선은 생각나는 메서드만 구현해봤습니다.

예시는 Home 셀에 적용해보았습니다. lor 네임스페이스로 접근하셔서 사용하심 될 듯 합니다.
근데 SnapKit 처럼 만드는 건 어떻게 해야 할까요? 얼핏 봤을때는 ConstraintItem 타입으로 인자가 들어오는 것 같았는데...

loopingPlayerView.lor.makeConstraints {
       $0.equalToSuperView()
}

많은 지적 부탁드립니다.

Linked Issue

close #49

@chopmozzi chopmozzi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다~

Comment on lines +30 to +32
func bottomAnchor(equalTo anchor: NSLayoutYAxisAnchor, constant: CGFloat = 0) {
view.bottomAnchor.constraint(equalTo: anchor, constant: constant).isActive = true
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 음수 -> 양수로 변환해주세요

@loinsir

loinsir commented Nov 21, 2023

Copy link
Copy Markdown
Collaborator Author

이건 우선 순위 낮춰서 나중에 더 구현할게요 :)

Comment on lines +12 to +16

func makeConstraints(_ closure: (ConstraintMaker) -> Void) {
base.translatesAutoresizingMaskIntoConstraints = false
closure(ConstraintMaker(base))
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateConstraints도 구현해주세요..
나중에 갖다 써야지..ㅎ

@chopmozzi

Copy link
Copy Markdown
Collaborator

벌써 1년이네요...

@loinsir

loinsir commented Oct 21, 2024

Copy link
Copy Markdown
Collaborator Author

@chopmozzi 지켜보고있다...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 오토레이아웃을 쉽게 사용하기 위한 extension 메서드 구현

3 participants