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

Sprint_04 #718

Open
wants to merge 7 commits into
base: project_sprint_3_start
Choose a base branch
from

Conversation

MaryMekh
Copy link

Сдача 4 спринта. Приложение Quiz по фильмам.

Comment on lines 3 to 24
final class MovieQuizViewController: UIViewController {
// MARK: - Lifecycle


@IBOutlet private var imageView: UIImageView!
@IBOutlet private var textLabel: UILabel!
@IBOutlet private var counterLabel: UILabel!
@IBAction private func yesButtonClicked(_ sender: Any) {
let currentQuestion = questions [currentQuestionIndex]
let givenAnswer = true

showAnswerResult (isCorrect: givenAnswer == currentQuestion.correctAnswer )
}

@IBAction private func noButtonClicked(_ sender: Any) {
let currentQuestion = questions[currentQuestionIndex]
let givenAnswer = false
showAnswerResult (isCorrect: givenAnswer == currentQuestion.correctAnswer )
}


private let questions: [QuizQuestion] = [QuizQuestion (image: "The Godfather",

Choose a reason for hiding this comment

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

Рекомендую внимательно следить за переносами строк для лучшей читаемости кода.

Дополнительный материал про кодстайл:

Comment on lines 78 to 96
private func showAnswerResult(isCorrect: Bool) {
if isCorrect == true {
correctAnswers += 1
imageView.layer.masksToBounds = true
imageView.layer.borderWidth = 8
imageView.layer.borderColor = UIColor.ypGreen.cgColor

} else {
imageView.layer.masksToBounds = true
imageView.layer.borderWidth = 8
imageView.layer.borderColor = UIColor.ypRed.cgColor

}

DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { [weak self] in
guard let self = self else {return}
self.showNextQuestionOrResult()
}
}

Choose a reason for hiding this comment

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

Чуть поехали отступы. Они помогают коду выглядеть аккуратнее и привычнее взгляду, так читать код намного удобнее. Чтобы поправить оступы: можно выделить весь код cmd+A и зажать contol+i.

Comment on lines 165 to 175
/*
Mock-данные


Картинка: The Godfather
Настоящий рейтинг: 9,2
Вопрос: Рейтинг этого фильма больше чем 6?
Ответ: ДА


Картинка: The Dark Knight

Choose a reason for hiding this comment

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

Mock данные лучше сразу убрать, они больше пригодятся.

Copy link
Author

@MaryMekh MaryMekh Feb 18, 2024

Choose a reason for hiding this comment

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

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

@MaryMekh
Copy link
Author

MaryMekh commented Feb 26, 2024 via email

@MaryMekh
Copy link
Author

Привет еще раз) Поправила.

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