-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add EmptyView #18
Add EmptyView #18
Conversation
zzzarya
commented
Apr 20, 2023
•
edited
Loading
edited
- Создана EmptyView
- Вместо картинки оставил емоджи папки. Поменяю, если предложите картинку)), я не смог пока придумать какую
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.
В целом как собирать вьюхи ты понял, не хватает публичного метода update, который принимает картинку и текст.
Вьюху положи в библиотеку рядом с ErrorView
Тебе также нужна моделька EmptyInputData
private lazy var emptyPictureLabel = makeEmptyPictureLabel() | ||
private lazy var emptyTextLabel = makeEmptyTextLabel() |
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.
по структуре все гуд, как я хочу ленивый элемент = функция make из расширения
- наименование можно проще - опционал
- нужна картинка!
stackContainer.axis = .vertical | ||
stackContainer.distribution = .fill | ||
stackContainer.alignment = .center | ||
stackContainer.spacing = 16 |
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.
spacing
надо использовать из Theme
stackContainer.spacing = Theme.spacing(usage: .standard2)
мой косяк дал пример, а сам в нем не избавился от магический цифр
top: 0, | ||
left: 16, | ||
bottom: 16, | ||
right: 16 |
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.
здесь тоже из темы
func makeEmptyTextLabel() -> UILabel { | ||
let label = UILabel() | ||
label.textColor = Theme.color(usage: .gray) | ||
label.text = "Empty folder" |
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.
если используешь внутренний текст (объявлен внутри класса), то используй такой вариант:
// MARK: - Appearance
private extension AboutViewController {
enum Appearance {
static let welcomeText = "Welcome to About"
static let title = "About"
}
}
и используй как label.text = Appearance.welcomeText
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.
Но этого тебе здесь не надо, нам нужна вьюха, которая принимает картинку и текст.