-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
|
||
import Foundation | ||
|
||
final class ChooseCategoryViewModel { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Было бы классно закрыть все view models протоколами, это бы повысило тестируемость кода
Tracker/Constants.swift
Outdated
|
||
typealias Binding<T> = (T) -> Void | ||
|
||
import Foundation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Обычно, импорты указывают выше всего кода, в том числе и typealias
-ов
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private lazy var pages: [UIViewController] = { | ||
let screen1 = OnboardingScreenViewController(backgroundImageString: screen1BackImageString, screenTextString: screen1LabelString) | ||
|
||
let screen2 = OnboardingScreenViewController(backgroundImageString: screen2BackImageString, screenTextString: screen2LabelString) | ||
|
||
return [screen1, screen2] | ||
}() |
There was a problem hiding this comment.
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? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Обычно, сначало идут не приватные методы - затем приватные)
Иногда подчинение какому-либо протоколу выносят в extension, и тогда не приватные методы находятся в нём, но по коду ниже приватных
No description provided.