Conversation
…з систему контроля версий
…и MovieQuizViewController
…и MovieQuizViewController.
Helvetii951
reviewed
Feb 18, 2024
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", |
There was a problem hiding this comment.
Рекомендую внимательно следить за переносами строк для лучшей читаемости кода.
Дополнительный материал про кодстайл:
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() | ||
| } | ||
| } |
There was a problem hiding this comment.
Чуть поехали отступы. Они помогают коду выглядеть аккуратнее и привычнее взгляду, так читать код намного удобнее. Чтобы поправить оступы: можно выделить весь код cmd+A и зажать contol+i.
Comment on lines
+165
to
+175
| /* | ||
| Mock-данные | ||
|
|
||
|
|
||
| Картинка: The Godfather | ||
| Настоящий рейтинг: 9,2 | ||
| Вопрос: Рейтинг этого фильма больше чем 6? | ||
| Ответ: ДА | ||
|
|
||
|
|
||
| Картинка: The Dark Knight |
There was a problem hiding this comment.
Mock данные лучше сразу убрать, они больше пригодятся.
Author
There was a problem hiding this comment.
Привет, спасибо, выравнила код, убрала коммент с мок-данными, залила в ветку изменения.
Author
|
https://github.com/MaryMekh/MovieQuiz-ios/tree/sprint_04
Привет, это 16 поток Ios- разработка, домашние задание по 4 спринту,
поправила по комментариям код еще неделю назад, но не догадалась скинуть
ссылку повторно на почту.
вс, 18 февр. 2024 г. в 10:40, Ренат Галямов ***@***.***>:
… ***@***.**** commented on this pull request.
------------------------------
In MovieQuiz/Presentation/MovieQuizViewController.swift
<#718 (comment)>
:
> 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",
Рекомендую внимательно следить за переносами строк для лучшей читаемости
кода.
Дополнительный материал про кодстайл:
- Подробное описание codestyle <https://google.github.io/swift/> от
Google
- От Ray Wanderlich
<https://github.com/raywenderlich/swift-style-guide>
- На русском от команды tutu
<https://github.com/tutu-ru/swift-style-guide>
------------------------------
In MovieQuiz/Presentation/MovieQuizViewController.swift
<#718 (comment)>
:
> + 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()
+ }
+ }
Чуть поехали отступы. Они помогают коду выглядеть аккуратнее и привычнее
взгляду, так читать код намного удобнее. Чтобы поправить оступы: можно
выделить весь код cmd+A и зажать contol+i.
------------------------------
In MovieQuiz/Presentation/MovieQuizViewController.swift
<#718 (comment)>
:
> + /*
+ Mock-данные
+
+
+ Картинка: The Godfather
+ Настоящий рейтинг: 9,2
+ Вопрос: Рейтинг этого фильма больше чем 6?
+ Ответ: ДА
+
+
+ Картинка: The Dark Knight
Mock данные лучше сразу убрать, они больше пригодятся.
—
Reply to this email directly, view it on GitHub
<#718 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BFWH4UUVAXXF5ZPPWYOYEJLYUHEAVAVCNFSM6AAAAABDNMOPG2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQOBXGE4DGNJWGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Author
|
Привет еще раз) Поправила. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Сдача 4 спринта. Приложение Quiz по фильмам.