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
| protocol ChatsService { | |
| func getChats(request: GetConversationsRequest) throws -> [Message] | |
| func getChatMessages(request: GetConversationMessagesRequest) throws -> [Message] | |
| func submitMessage(request: SubmitMessageRequest) throws -> Message | |
| func getUnreadMessagesNumber() throws -> Int | |
| } |
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
| extension String { | |
| public var initials: String { | |
| var finalString = String() | |
| var words = components(separatedBy: .whitespacesAndNewlines) | |
| if let firstCharacter = words.first?.first { | |
| finalString.append(String(firstCharacter)) | |
| words.removeFirst() | |
| } | |
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
| extension UIImage { | |
| static func roundedTextAvatar(text: String?, | |
| color: UIColor, | |
| circular: Bool, | |
| textAttributes: [NSAttributedStringKey: Any]?, | |
| size: CGSize) -> UIImage? { | |
| let scale = Float(UIScreen.main.scale) | |
| UIGraphicsBeginImageContextWithOptions(size, false, CGFloat(scale)) | |
| let context = UIGraphicsGetCurrentContext() |
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
| public protocol Copyable { | |
| init(other: Self) | |
| } | |
| public extension Copyable { | |
| public func copy() -> Self { | |
| return Self.init(other: self) | |
| } | |
| } |
NewerOlder