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

Feed/title body+view more #161

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open

Conversation

ethanswift
Copy link
Contributor

What this PR does:

creates views for title, body and view more button

Checklist

  • Compiler warnings resolved
  • Linter warnings resolved
  • User-facing strings in Localizable.strings file
  • Unused code, print statements, and comments removed

Which issue(s) this PR fixes:

Resolves #

Special notes for reviewers:

Additional comments:

.bottom(to: \.bottomAnchor, constant: -5)
}

func heighOfBody(text: String) -> CGFloat {
Copy link
Collaborator

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?

Copy link
Contributor Author

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)
Copy link
Collaborator

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)

Copy link
Contributor Author

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 {
Copy link
Collaborator

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.

Copy link
Contributor Author

@ethanswift ethanswift May 30, 2020

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: " ")
Copy link
Collaborator

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?

Copy link
Contributor Author

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)
Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh! that's right

@devarshjoshi
Copy link
Collaborator

@ethanswift @OnyekachiSamuel can we resolve this pull request?

@devarshjoshi
Copy link
Collaborator

@ethanswift @OnyekachiSamuel @stavares843 @eddyteddy3 We need someone to resolve conflicts here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feed/Offer-Request Card - View More
4 participants