Skip to content

Develop#4

Open
Adletski wants to merge 9 commits intomainfrom
develop
Open

Develop#4
Adletski wants to merge 9 commits intomainfrom
develop

Conversation

@Adletski
Copy link
Owner

finished adding features, ready merge to main

import UIKit
import SnapKit

class AlbumCellHeader: UICollectionReusableView {
Copy link

Choose a reason for hiding this comment

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

final class

return button
}()

override init(frame: CGRect) {
Copy link

Choose a reason for hiding this comment

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

нужно добавить // MARK

return image
}()

lazy var title: UILabel = {
Copy link

Choose a reason for hiding this comment

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

titleLabel, если будет просто title как будто данные из модели, лучше всегда делать привзяку UI элементам

return label
}()

lazy var quantity: UILabel = {
Copy link

Choose a reason for hiding this comment

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

quantityLabel

return stack
}()

override init(frame: CGRect) {
Copy link

Choose a reason for hiding this comment

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

// MARK: нужны


override init(frame: CGRect) {
super.init(frame: frame)
clipsToBounds = true
Copy link

Choose a reason for hiding this comment

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

это точно нужно? лучше его в метод setupviews


static let identifier = "AlbumCollectionViewCell"

lazy var image: UIImageView = {
Copy link

Choose a reason for hiding this comment

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

лучше, сделай другой нейминг какой именно image

}

override func prepareForReuse() {
self.image.image = nil
Copy link

Choose a reason for hiding this comment

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

self.image.image плохое обращения, лучше подумай как можно сделать перемениновать ui свойство


import UIKit

class AlbumsViewController: UIViewController {
Copy link

Choose a reason for hiding this comment

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

final


private let settingsDelegate = MediaCollectionViewCell()

private lazy var collectionView: UICollectionView = {
Copy link

Choose a reason for hiding this comment

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

// MARK: - UI

return collectionView
}()

override func viewDidLoad() {
Copy link

Choose a reason for hiding this comment

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

// MARK: - Lifecycle


override func viewDidLoad() {
super.viewDidLoad()
setupController()
Copy link

Choose a reason for hiding this comment

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

setupController -> setupNavigationController

}

private func setupController() {
view.backgroundColor = .white
Copy link

Choose a reason for hiding this comment

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

    view.backgroundColor = .white должен быть в методе setupViews

}
}

@objc func libraryNCleftButtonTapped() { }
Copy link

Choose a reason for hiding this comment

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

// MARK: - Actions


@objc func libraryNCleftButtonTapped() { }

private func createLayout() -> UICollectionViewCompositionalLayout {
Copy link

Choose a reason for hiding this comment

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

// MARK: - Private

heightDimension: .absolute(44)
)
let layoutGroup = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [layoutItem])
// layoutGroup.contentInsets = NSDirectionalEdgeInsets(top: 5, leading: 5, bottom: 5, trailing: 5)
Copy link

Choose a reason for hiding this comment

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

dead code, нельзя замочиенный код отправять в гит, всегда перед отправкой проверяй свой код, нужно удалить

}
}

extension AlbumsViewController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
Copy link

Choose a reason for hiding this comment

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

// MARK: - Extensions


extension AlbumsViewController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
func numberOfSections(in collectionView: UICollectionView) -> Int {
AlbumModel.modelsArray.count
Copy link

Choose a reason for hiding this comment

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

лучше return писать явно, return AlbumModel.modelsArray.count

}

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
AlbumModel.modelsArray[section].count
Copy link

Choose a reason for hiding this comment

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

лучше return писать явно, return AlbumModel.modelsArray[section].count


import UIKit

class MediaCollectionViewCell: UICollectionViewCell {
Copy link

Choose a reason for hiding this comment

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

final


static let identifier = "MediaCollectionViewCell"

lazy var image: UIImageView = {
Copy link

Choose a reason for hiding this comment

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

public, лучше явно указовай acess модификаторы


private func setupConstraints() {
image.snp.makeConstraints {
$0.centerY.equalTo(contentView)
Copy link

Choose a reason for hiding this comment

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

$0.centerY.leading.equalTo(contentView)

}

override func prepareForReuse() {
self.image.image = nil
Copy link

Choose a reason for hiding this comment

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

super.prepareForReuse забыл


import UIKit

class ForYouViewController: UIViewController {
Copy link

Choose a reason for hiding this comment

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

final

navigationItem.leftBarButtonItem?.tintColor = .black
}

@objc func libraryNCleftButtonTapped() { }
Copy link

Choose a reason for hiding this comment

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

// MARK: - Actions

super.viewDidLoad()
view.backgroundColor = .white
title = "For You"
navigationController?.navigationBar.prefersLargeTitles = true
Copy link

Choose a reason for hiding this comment

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

нужно вынести в отдельные методы, во viewdidload не должно быть логики

import UIKit
import SnapKit

class LibraryViewController: UIViewController {
Copy link

Choose a reason for hiding this comment

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

final


class LibraryViewController: UIViewController {

private lazy var collectionView: UICollectionView = {
Copy link

Choose a reason for hiding this comment

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

// MARK: - UI Properties

return collectionView
}()

override func viewDidLoad() {
Copy link

Choose a reason for hiding this comment

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

// MARK: - Lifecycle

setupConstraints()
}

private func setupController() {
Copy link

Choose a reason for hiding this comment

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

setupNavBar


private func setupConstraints() {
collectionView.snp.makeConstraints {
$0.left.top.right.bottom.equalToSuperview()
Copy link

Choose a reason for hiding this comment

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

$0.edges.equatlToSuperView()

}
}

@objc func libraryNCleftButtonTapped() { }
Copy link

Choose a reason for hiding this comment

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

// MARK: - Actions


import UIKit

class SearchViewController: UIViewController {
Copy link

Choose a reason for hiding this comment

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

final


class SearchViewController: UIViewController {

override func viewDidLoad() {
Copy link

Choose a reason for hiding this comment

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

// MARK: - Lifecycle

super.viewDidLoad()
view.backgroundColor = .white
title = "Search"
navigationController?.navigationBar.prefersLargeTitles = true
Copy link

Choose a reason for hiding this comment

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

вынести в отдельный метод

navigationItem.leftBarButtonItem?.tintColor = .black
}

@objc func libraryNCleftButtonTapped() { }
Copy link

Choose a reason for hiding this comment

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

// MARK: - Actions


import UIKit

class TabBarController: UITabBarController {
Copy link

Choose a reason for hiding this comment

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

final


class TabBarController: UITabBarController {

override func viewDidLoad() {
Copy link

Choose a reason for hiding this comment

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

// MARK

}

func setupTabBarViewControllers() {
let libraryVC = LibraryViewController()
Copy link

Choose a reason for hiding this comment

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

не сокращай, libraryVC VC плохой нейминг, пиши полностью viewcontroller

let searchIcon = UITabBarItem(title: "Search", image: UIImage(systemName: "magnifyingglass"), selectedImage: UIImage(systemName: "magnifyingglass"))
searchVC.tabBarItem = searchIcon

let libraryNC = UINavigationController(rootViewController: libraryVC)
Copy link

Choose a reason for hiding this comment

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

здесь тоже самое пишем полностью

}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let item = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)
Copy link

Choose a reason for hiding this comment

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

cell Identifier лучше вынести во. static

let layoutGroup = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [layoutItem])
// layoutGroup.contentInsets = NSDirectionalEdgeInsets(top: 5, leading: 5, bottom: 5, trailing: 5)
let layoutSection = NSCollectionLayoutSection(group: layoutGroup)
// layoutSection.orthogonalScrollingBehavior = .continuous
Copy link

Choose a reason for hiding this comment

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

dead code


import UIKit

struct AlbumModel {
Copy link

Choose a reason for hiding this comment

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

лучше пиши Album, models нагружает читабельность

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