-
Notifications
You must be signed in to change notification settings - Fork 7
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
Feed/title body+view more #161
base: develop
Are you sure you want to change the base?
Conversation
.bottom(to: \.bottomAnchor, constant: -5) | ||
} | ||
|
||
func heighOfBody(text: String) -> CGFloat { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work Ethan, can we abstract out this method and reuse it in the other place where you also used it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, this is already available. it depends on the font and font size, so we can access it with FeeBodyTxt.heightOfBody(text: String)
bodyLbl.makeSubview(of: self) | ||
.width(UIScreen.main.bounds.width - 40) | ||
.height(heighOfBody(text: newTxt)) | ||
viewMore.makeSubview(of: self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To position the viewMore button correctly, check out the code snippet below:
viewMore.makeSubview(of: self) .top(to: \.bottomAnchor, of: bodyLbl, relation: .equal, constant: -20, priority: .required) .trailing(to: \.trailingAnchor, of: bodyLbl, relation: .equal, constant: -10, priority: .required) .height(16)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking for a way to attach the button to the end of text (which has different length), do you have any solution for that?
I mean for example if the text ends in the beginning of the line, the button appears there, if the text appear in the middle of the text the button appears there if the text ends at the end of the line the button appears there.
.height(heighOfTitle(title: title)) | ||
} | ||
|
||
func heighOfTitle(title: String) -> CGFloat { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, please do try to fix the lint warning here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the swiftLint was disabled in my code, I'm trying to fix this later. (update, fixed)
} | ||
|
||
func setUp() { | ||
let newTxt = text.components(separatedBy: " ").dropLast().dropLast().dropLast().joined(separator: " ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the purpose of this code here, please can you help put me through?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the words that appear at the end of text sometimes overlapped with the button, I tried to fix this.
bodyLbl.numberOfLines = 0 | ||
bodyLbl.lineBreakMode = .byWordWrapping | ||
bodyLbl.makeSubview(of: self) | ||
.width(UIScreen.main.bounds.width - 40) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can constrain the bodyLbl to the the width of its parent view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! that's right
@ethanswift @OnyekachiSamuel can we resolve this pull request? |
@ethanswift @OnyekachiSamuel @stavares843 @eddyteddy3 We need someone to resolve conflicts here |
What this PR does:
creates views for title, body and view more button
Checklist
Which issue(s) this PR fixes:
Resolves #
Special notes for reviewers:
Additional comments: