-
Notifications
You must be signed in to change notification settings - Fork 1
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
Score updates #7
base: main
Are you sure you want to change the base?
Conversation
…ck in YambViewController
Yamb/YambDataSource.swift
Outdated
var tmp = 0 | ||
if let field = fieldsDict[indexPath.section]?[indexPath.item] { | ||
if (field.score != nil) { | ||
tmp = field.score! |
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.
never force unwrap! Use if let fieldScore = field.score {
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.
Yamb/YambDataSource.swift
Outdated
@@ -198,7 +220,8 @@ class YambDataSource { | |||
} | |||
|
|||
func clear(indexPath: IndexPath) { | |||
if let field = fieldsDict[indexPath.section]?[indexPath.item] { | |||
if let field = fieldsDict[indexPath.section]?[indexPath.row] { |
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.
why did you switch to .row?
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.
I wasn't sure what the difference was between .item and .row and was testing out, I changed it back to .item
Yamb/YambViewController.swift
Outdated
return stackView | ||
}() | ||
|
||
lazy var button: UIButton = { | ||
lazy var NewGameButton: UIButton = { |
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.
names start with non-capital letter
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.
Yamb/YambDataSource.swift
Outdated
@@ -79,11 +79,17 @@ class YambDataSource { | |||
return [0:topFields, 1:middleFields, 2:bottomFields] | |||
}() | |||
|
|||
var totalScore: Int { | |||
lazy var totalScore: Int = { |
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.
lazy var initializers are only called once. this should be a computed property. it is enough to say
var totalScore: Int = { getTotalScore() }
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.
Yamb/YambViewController.swift
Outdated
//self.navigationController?.navigationBar.isHidden = true | ||
|
||
} | ||
|
||
|
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.
dobule new line
No description provided.