Last active
April 15, 2020 13:53
-
-
Save b-onc/672d098fa660a1adbe6fceabb162b362 to your computer and use it in GitHub Desktop.
This file contains 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
override func viewDidLoad() { | |
presenter = ChannelsPresenter(filter: .currentUserInMembers) | |
title = "Messages" | |
setupStyles() | |
tableView.tableFooterView = nil | |
navigationItem.largeTitleDisplayMode = .always | |
deleteChannelBySwipe = true | |
super.viewDidLoad() | |
} | |
private func setupStyles() { | |
view.directionalLayoutMargins.leading = 24 | |
let paragraphStyle = NSMutableParagraphStyle() | |
paragraphStyle.firstLineHeadIndent = view.layoutMargins.left - 16 | |
navigationController?.navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.paragraphStyle: paragraphStyle] | |
style.channel.nameFont = .boldSystemFont(ofSize: 16) | |
style.channel.nameColor = .black | |
style.channel.nameUnreadFont = .boldSystemFont(ofSize: 16) | |
style.channel.nameUnreadColor = .black | |
style.channel.messageFont = .systemFont(ofSize: 15) | |
style.channel.messageColor = .gray | |
style.channel.messageNumberOfLines = 2 | |
style.channel.messageUnreadFont = .systemFont(ofSize: 15) | |
style.channel.messageUnreadColor = .gray | |
style.channel.messageNumberOfLines = 2 | |
style.channel.dateFont = .systemFont(ofSize: 15) | |
style.channel.dateColor = .gray | |
style.channel.verticalTextAlignment = .top | |
let separatorStyle = SeparatorStyle(color: UIColor.lightGray.withAlphaComponent(0.6), | |
inset: UIEdgeInsets(top: 0, left: view.layoutMargins.left, bottom: 0, right: 0), | |
tableStyle: .singleLine) | |
style.channel.separatorStyle = separatorStyle | |
style.channel.spacing.vertical = 2 | |
style.channel.spacing.horizontal = 16 | |
style.channel.avatarViewStyle?.verticalAlignment = .center | |
style.channel.avatarViewStyle?.radius = 46 / 2 | |
style.channel.height = 46 + 16 * 2 | |
style.channel.edgeInsets.top = 8 | |
style.channel.edgeInsets.bottom = 8 | |
style.channel.edgeInsets.left = view.layoutMargins.left | |
style.channel.edgeInsets.right = view.layoutMargins.right + 16 * 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment