-
Notifications
You must be signed in to change notification settings - Fork 108
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
StringDescriptor Formatter #395
Conversation
SwiftLint found issuesWarnings
Generated by 🚫 Danger |
/// Returns the receiver *Bold* version. | ||
/// | ||
var bold: UIFont { | ||
guard let italicDescriptor = fontDescriptor.withSymbolicTraits(.traitBold) else { |
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 think you mean boldDescriptor
instead of italicDescriptor
here
return self | ||
} | ||
|
||
return UIFont(descriptor: italicDescriptor, size: pointSize) |
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.
same
.replacingOccurrences(of: " \t", with: String.space + String.hairSpace) // tabs after a space | ||
.replacingOccurrences(of: "\t@", with: String.hairSpace + "@") // tabs before @mentions | ||
.replacingOccurrences(of: "\t.", with: String.hairSpace + ".") // tabs before a space | ||
.replacingOccurrences(of: "\t,", with: String.hairSpace + ",") // tabs cefore a comman |
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.
nitpicky: comment tabs before a comma
}() | ||
|
||
|
||
/// Styles: Notification Defailts / Badge Blocks |
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.
nitpicky - Defaults
instead of Defailts
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.
@jleandroperez I poured over the code and did not find any issues (beyond what @mindgraffiti noted) — StringFormatter
looks straight-forward in terms of usage. Can't wait to give this a try in the UI!
!
@@ -4,8 +4,16 @@ import UIKit | |||
// MARK: - Style defines the basic API of a Woo Skin. | |||
// | |||
protocol Style { |
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 for organizing this! ❤️
Thank you both!! ❤️ |
Details:
This PR implements a new tool, to be used in the Notifications List / Details, to be known as StringFormatter.
Given a String, a collection of Range Descriptors, and Styles (Bold, Italics, etc), this tool will produce a NSAttributedString instance with its metadata stylized.
Testing:
Notes:
StringStyles.swift contains a (temporary) private structure, called
NukeMe
. This will be removed, as soon as we do have a way to visually test how this class works, and get to fine-tune the colors.(Subtask added in the main ticket).
cc @bummytime thanks in advance!!