Skip to content

New placeholders #250

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

Merged
merged 10 commits into from
Mar 21, 2018
Merged

New placeholders #250

merged 10 commits into from
Mar 21, 2018

Conversation

kvld
Copy link
Contributor

@kvld kvld commented Mar 16, 2018

Задача: #APPS-1808

Коротко для Release Notes, в формате «Сделали/Добавили/Исправили N»:
Обновили плейсхолдеры

Описание:
Обновленные (по макетам) плейсхолдеры. Добавлен класс StepikTableView – UITableView, для которого поддерживаются пустые состояния. Все базовые плейсхолдеры объявлены как static-константы в StepikPlaceholder.Style. Пример использования:

class ViewController: UIViewController {
    var tableView: StepikTableView
    
    ...
    
    override func viewDidLoad() {
    
        ...
     
        // Предопределенный плейсхолдер
        tableView.emptySetPlaceholder = StepikPlaceholder(.emptyNotifications) {
            print("Placeholder button clicked")
        }

        // Кастомный плейсхолдер
        let customStyle = StepikPlaceholderStyle(id: "custom_placeholder", image: nil,  text: "Some text", buttonTitle: "Button title")
        tableView.emptySetPlaceholder = StepikPlaceholder(customStyle) { }
    }
}

TODO

  • Плейсхолдеры без изображений и без кнопок
  • Локализация
  • Layout warning
  • Реимпорт ассетов

Замена

  • Нотификации
  • Загрузки

@kvld kvld added this to the 1.55 milestone Mar 16, 2018
@kvld kvld self-assigned this Mar 16, 2018
@kvld kvld requested a review from Ostrenkiy March 16, 2018 14:05
@Ostrenkiy
Copy link
Contributor

По тому, как использовать - сделано очень круто и удобно, прям 10/10.


lazy private var allPlaceholders: [StepikPlaceholderStyle.PlaceholderId: StepikPlaceholderStyle] = {
var idToView: [StepikPlaceholderStyle.PlaceholderId: StepikPlaceholderStyle] = [:]
for (k, v) in zip(StepikPlaceholder.availablePlaceholders.map({ $0.id }), StepikPlaceholder.availablePlaceholders) {
Copy link
Contributor

Choose a reason for hiding this comment

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

это ведь можно заменить на

for placeholder in StepikPlaceholder.availablePlaceholders {
    idToView[placeholder.id] = placeholder
}

static let vertical = CGFloat(500)
}

struct imageHeightToFrameHeightRation {
Copy link
Contributor

Choose a reason for hiding this comment

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

опечатка: Ratio

self.tableView.emptyDataSetSource = self

tableView.emptySetPlaceholder = StepikPlaceholder(.emptyDownloads) { [weak self] in
self?.tabBarController?.selectedIndex = 1
Copy link
Contributor

Choose a reason for hiding this comment

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

надо будет порефакторить tabBarController, чтобы селектить по айдишке, а не по индексу
но сейчас норм и так

@kvld kvld merged commit 2bd102b into dev Mar 21, 2018
@kvld kvld deleted the feature/new-placeholders branch March 21, 2018 09:12
@kvld kvld mentioned this pull request Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants