Created
April 27, 2019 16:24
-
-
Save fjtrujy/5eb0dd07b1860d2ffe59e821b79206bf to your computer and use it in GitHub Desktop.
RequestFriendsAttributedDecorator private
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //MARK: - RequestFriendsAttributedDecorator | |
| private extension RequestFriendsAttributedDecorator { | |
| var mainColor : UIColor { | |
| return UIColor.black | |
| } | |
| var softColor : UIColor { | |
| return UIColor.gray | |
| } | |
| var mainFont : UIFont { | |
| return UIFont.boldSystemFont(ofSize:15) | |
| } | |
| var secondaryFont : UIFont { | |
| return UIFont.systemFont(ofSize:13) | |
| } | |
| var alternativeFont : UIFont { | |
| return UIFont.systemFont(ofSize:15) | |
| } | |
| var smalFont : UIFont { | |
| return UIFont.systemFont(ofSize:9) | |
| } | |
| var mainAttributes : [NSAttributedString.Key : Any] { | |
| return [ | |
| NSAttributedString.Key.font : mainFont, | |
| NSAttributedString.Key.foregroundColor : mainColor, | |
| ] | |
| } | |
| var softAttributes : [NSAttributedString.Key : Any] { | |
| return [ | |
| NSAttributedString.Key.font : secondaryFont, | |
| NSAttributedString.Key.foregroundColor : softColor, | |
| ] | |
| } | |
| var alternativeAttributes : [NSAttributedString.Key : Any] { | |
| return [ | |
| NSAttributedString.Key.font : alternativeFont, | |
| NSAttributedString.Key.foregroundColor : mainColor, | |
| ] | |
| } | |
| var smallAttributes : [NSAttributedString.Key : Any] { | |
| return [ | |
| NSAttributedString.Key.font : smalFont, | |
| NSAttributedString.Key.foregroundColor : mainColor, | |
| ] | |
| } | |
| var attributedBreakLine : NSAttributedString { | |
| return NSAttributedString(string: "\n", attributes:smallAttributes) | |
| } | |
| var requestFriendAttributedIcon : NSAttributedString { | |
| let imageAttachment = NSTextAttachment() | |
| imageAttachment.image = UIImage(named: "requestFriend") | |
| changeAttachmentImageHeight(attachment: imageAttachment, height: mainFont.pointSize) | |
| return NSAttributedString(attachment: imageAttachment) | |
| } | |
| var mainAttributedInfo : NSAttributedString { | |
| let attr = NSMutableAttributedString() | |
| attr.append(NSAttributedString(string: "Miguél Ángel Gutiérrez, Elena Benítez ", attributes: mainAttributes)) | |
| attr.append(NSAttributedString(string: "and other 3 accepted your friend requests.", attributes: alternativeAttributes)) | |
| return attr | |
| } | |
| var descAttributedInfo : NSAttributedString { | |
| let attr = NSMutableAttributedString() | |
| attr.append(requestFriendAttributedIcon) | |
| attr.append(NSAttributedString(string: " Wednesday at 19:25.", attributes: softAttributes)) | |
| return attr | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment