Skip to content

Sprint_17#10

Open
rfhfv wants to merge 4 commits into
mainfrom
Sprint_17
Open

Sprint_17#10
rfhfv wants to merge 4 commits into
mainfrom
Sprint_17

Conversation

@rfhfv

@rfhfv rfhfv commented Feb 6, 2024

Copy link
Copy Markdown
Owner

No description provided.

// MARK: - UICollectionViewDataSource

extension StatisticsViewController: UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Рекомендую придерживаться следующего стиля написания длинных вызовов и длинных объявлений функций.

func collectionView(
        _ collectionView: UICollectionView,
        layout collectionViewLayout: UICollectionViewLayout,
        sizeForItemAt indexPath: IndexPath
    ) -> CGSize {

Такой формат принят за основу во многих компаниях и следование ему даст несколько очков к карме при работе над боевыми проектами

statistics.removeAll()
} else {
statistics = [
.init(title: "Лучший период", value: "\(bestPeriod())"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Рекомендую НЕ использовать .init для создания объектов, так как такой способ работает чуть медленнее, а если таких месть будет больше, то разница будет ощутимой. Лучше использовать полное название класса/структуры для инициализаци. Например тут будет:

StatisticsModel(title: "Лучший период", value: "\(bestPeriod())")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так как это тоже сервис, то лучше перенести всю папку в папку Services, а AppDelegate и SceneDelegate наоборот оттуда убрать

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно удалить кажется

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants