Skip to content

Hw1#1

Open
alexander-gileta wants to merge 3 commits into
mainfrom
hw1
Open

Hw1#1
alexander-gileta wants to merge 3 commits into
mainfrom
hw1

Conversation

@alexander-gileta

Copy link
Copy Markdown
Owner

No description provided.

], message: "Главное меню:")

switch choice {
case 1:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Цифры лучше заменить на enum, чтобы иметь compile time проверки

}

class ConsoleUI {
func showMenuList(options: [String], message: String = "Выберите действие:") -> Int {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Лучше такое выносить в константы

if let input = readLine(), let choice = Int(input), choice > 0, choice <= options.count {
return choice
} else {
print("Неверный ввод. Попробуйте снова.")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Принт лучше инджектить в виде зависимости. Если вдруг захочешь это на CI потом. Там другой вывод в консоль может понадобиться

}
}

enum MenuState {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Когда много кода в одном файле (понимаю, что таково задание, но просто совет) – отдельные типы лучше выделять комментами. На iOS особенно и использовать // MARK: -

}
}

protocol CanvasUnit {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Что-то не нашел ответа на пункт "подумайте как лучше стоит реализовать это в iOS и в Android". поэтому по продвинутой части минус

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