-
Notifications
You must be signed in to change notification settings - Fork 686
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
base: project_sprint_3_start
Are you sure you want to change the base?
Sprint_04 #718
Conversation
…з систему контроля версий
…и MovieQuizViewController
…и MovieQuizViewController.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Рекомендую внимательно следить за переносами строк для лучшей читаемости кода.
Дополнительный материал про кодстайл:
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Чуть поехали отступы. Они помогают коду выглядеть аккуратнее и привычнее взгляду, так читать код намного удобнее. Чтобы поправить оступы: можно выделить весь код cmd+A
и зажать contol+i
.
/* | ||
Mock-данные | ||
|
||
|
||
Картинка: The Godfather | ||
Настоящий рейтинг: 9,2 | ||
Вопрос: Рейтинг этого фильма больше чем 6? | ||
Ответ: ДА | ||
|
||
|
||
Картинка: The Dark Knight |
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.
Mock данные лучше сразу убрать, они больше пригодятся.
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.
Привет, спасибо, выравнила код, убрала коммент с мок-данными, залила в ветку изменения.
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:
***@***.***>
|
Привет еще раз) Поправила. |
Сдача 4 спринта. Приложение Quiz по фильмам.