mirror of
https://github.com/MessageKit/MessageKit.git
synced 2026-02-06 19:03:19 +00:00
Added Swiftlint and Swiftformat plugins (#1729)
* build: Swiftlint plugin * build: Swiftformat plugin * build: Swiftformat plugin * build: Swiftformat bash command * style: Swiftformat rules * style: Swiftformat applied to codebase * style: Ignore Tests for Swiftlint * Update bundler * Update changelog and migration guide * style: Ignore Example for Swiftlint * chore: Changelog * Update Xcode version for ci_pr_tests.yml * Update ci_pr_framework.yml * Update ci_pr_example.yml * chore: Changelog Co-authored-by: Jakub Kaspar <kaspikk@gmail.com>
This commit is contained in:
co-authored by
Jakub Kaspar
parent
f3f61ebbc9
commit
bff35fda61
@@ -6,40 +6,57 @@
|
||||
// Copyright © 2021 MessageKit. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Kingfisher
|
||||
import MapKit
|
||||
import MessageKit
|
||||
import Kingfisher
|
||||
import UIKit
|
||||
|
||||
class CustomLayoutExampleViewController: BasicExampleViewController {
|
||||
|
||||
private lazy var textMessageSizeCalculator: CustomTextLayoutSizeCalculator = CustomTextLayoutSizeCalculator(layout: self.messagesCollectionView.messagesCollectionViewFlowLayout)
|
||||
|
||||
override func configureMessageCollectionView() {
|
||||
super.configureMessageCollectionView()
|
||||
self.messagesCollectionView.register(CustomTextMessageContentCell.self)
|
||||
messagesCollectionView.messagesDataSource = self
|
||||
messagesCollectionView.messagesLayoutDelegate = self
|
||||
messagesCollectionView.messagesDisplayDelegate = self
|
||||
}
|
||||
|
||||
// MARK: - MessagesLayoutDelegate
|
||||
|
||||
override func textCellSizeCalculator(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> CellSizeCalculator? {
|
||||
return self.textMessageSizeCalculator
|
||||
}
|
||||
|
||||
// MARK: - MessagesDataSource
|
||||
|
||||
override func textCell(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> UICollectionViewCell? {
|
||||
let cell = messagesCollectionView.dequeueReusableCell(CustomTextMessageContentCell.self,
|
||||
for: indexPath)
|
||||
cell.configure(with: message,
|
||||
at: indexPath,
|
||||
in: messagesCollectionView,
|
||||
dataSource: self,
|
||||
and: self.textMessageSizeCalculator)
|
||||
|
||||
return cell
|
||||
}
|
||||
// MARK: Internal
|
||||
|
||||
override func configureMessageCollectionView() {
|
||||
super.configureMessageCollectionView()
|
||||
messagesCollectionView.register(CustomTextMessageContentCell.self)
|
||||
messagesCollectionView.messagesDataSource = self
|
||||
messagesCollectionView.messagesLayoutDelegate = self
|
||||
messagesCollectionView.messagesDisplayDelegate = self
|
||||
}
|
||||
|
||||
// MARK: - MessagesLayoutDelegate
|
||||
|
||||
override func textCellSizeCalculator(
|
||||
for _: MessageType,
|
||||
at _: IndexPath,
|
||||
in _: MessagesCollectionView)
|
||||
-> CellSizeCalculator?
|
||||
{
|
||||
textMessageSizeCalculator
|
||||
}
|
||||
|
||||
// MARK: - MessagesDataSource
|
||||
|
||||
override func textCell(
|
||||
for message: MessageType,
|
||||
at indexPath: IndexPath,
|
||||
in messagesCollectionView: MessagesCollectionView)
|
||||
-> UICollectionViewCell?
|
||||
{
|
||||
let cell = messagesCollectionView.dequeueReusableCell(
|
||||
CustomTextMessageContentCell.self,
|
||||
for: indexPath)
|
||||
cell.configure(
|
||||
with: message,
|
||||
at: indexPath,
|
||||
in: messagesCollectionView,
|
||||
dataSource: self,
|
||||
and: textMessageSizeCalculator)
|
||||
|
||||
return cell
|
||||
}
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private lazy var textMessageSizeCalculator = CustomTextLayoutSizeCalculator(
|
||||
layout: self.messagesCollectionView
|
||||
.messagesCollectionViewFlowLayout)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user