Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Правки по спринту 16 #4

Merged
merged 10 commits into from
Sep 12, 2024
Merged

Правки по спринту 16 #4

merged 10 commits into from
Sep 12, 2024

Conversation

freeagles1991
Copy link
Owner

No description provided.


import Foundation

final class ChooseCategoryViewModel {
Copy link

Choose a reason for hiding this comment

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

Было бы классно закрыть все view models протоколами, это бы повысило тестируемость кода


typealias Binding<T> = (T) -> Void

import Foundation
Copy link

Choose a reason for hiding this comment

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

Обычно, импорты указывают выше всего кода, в том числе и typealias-ов

Copy link
Owner Author

Choose a reason for hiding this comment

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

Comment on lines +29 to +35
private lazy var pages: [UIViewController] = {
let screen1 = OnboardingScreenViewController(backgroundImageString: screen1BackImageString, screenTextString: screen1LabelString)

let screen2 = OnboardingScreenViewController(backgroundImageString: screen2BackImageString, screenTextString: screen2LabelString)

return [screen1, screen2]
}()
Copy link

Choose a reason for hiding this comment

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

можно упростить:

    private var pages: [UIViewController] = [
        OnboardingScreenViewController(
            backgroundImageString: "Отслеживайте только то, что хотите",
            screenTextString: "onboardingBack1"
        ),
        OnboardingScreenViewController(
            backgroundImageString: "Даже если это не литры воды и йога",
            screenTextString: "onboardingBack2"
        )
    ]

Если же охото сохранить строки в именнованные константы, то их можно сделать статик, тогда не придётся делать лейзи массив


// MARK: - UIPageViewControllerDataSource

func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? {
Copy link

Choose a reason for hiding this comment

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

Обычно, сначало идут не приватные методы - затем приватные)
Иногда подчинение какому-либо протоколу выносят в extension, и тогда не приватные методы находятся в нём, но по коду ниже приватных

@freeagles1991 freeagles1991 merged commit e4f7fda into main Sep 12, 2024
@freeagles1991 freeagles1991 deleted the sprint_16 branch December 3, 2024 13:41
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