Closing loopholes for cheaters
Big Nerd Ranch Forums
by Hans134
1w ago
In Chapter 4 it was explained that the value of a variable may be retrieved (after rotating the device) by adding the savedStateHandle. So my question is why the following doesn’t work to store and retrieve the value of “isCheater” when rotating the device: var isCheater: Boolean get()=savedStateHandle.get(IS_CHEATER_KEY) ?:false set(value)=savedStateHandle.set(IS_CHEATER_KEY,value) 1 post - 1 participant Read full topic ..read more
Visit website
Unresolved Reference: CrimeListFragmentDirections
Big Nerd Ranch Forums
by imgabe
1w ago
I ended up figuring this out, but just in case anyone else has the same problem. The method for adding the Safe Args plugin has changed since the book was published. See: Pass Data Between Destinations | Android Developers In the Project level build.gradle.kts add: buildscript { repositories { google() } dependencies { val nav_version = "2.7.7" classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version") } } and then in the Module:app build.gradle.kts add: plugins { id("androidx.navigation.safeargs.kotlin") } then Android Stud ..read more
Visit website
Variable was written to, but never read
Big Nerd Ranch Forums
by hairyyak
2w ago
Heres’ the code: Blockquote import Cocoa enum Token : CustomStringConvertible { case number(Int) case plus case minus case multiplication case division var description: String { switch self { case .number(let n): return "Number: \(n)" case .plus: return "Symbol: +" case .minus: return "Symbol: -" case .multiplication: return "Symbol: *" case .division: return "Symbol: /" }; } } class Lexer { func getNumber() → Int { var value = 0 while let nextCharacter = peek() { switch nextCharacter { case "0"..."9 ..read more
Visit website
Chapter 4 Adding a view model
Big Nerd Ranch Forums
by Hans134
1M ago
According to Listing 4.3 I added the line: private val quizViewModel: QuizViewModel by viewModels() but QuizViewModel is coloured red, and show the msg: “unresolved reference”. Furthermore viewModels() is underlined. I made the ViewModel class according to Listing 4.2 and I added the depencies as shown in listing 4.1 Also I added “import androidx.activity.viewModels” in the MainActivity.kt file. I am using Android Studio Hedgehog. What can be wrong ? 1 post - 1 participant Read full topic ..read more
Visit website
Chapter 1 Android Programming HELP
Big Nerd Ranch Forums
by noho21112
1M ago
I am getting this theme error when trying to run my device. I am not sure where it is coming from or what I am doing wrong. I am using groovy language. here is my current code in the comments: 4 posts - 1 participant Read full topic ..read more
Visit website
Dynamic Cell Heights
Big Nerd Ranch Forums
by yanichik
2M ago
I do not see any difference between setting or not setting the rowHeight to automaticDimension and estimatedRowHeight to 65. In order to test the difference in behaviors I set the fixed cell height to 40 inside size inspector and then tried building with and without these two attributes. Aside from added performance which the estimatedRowHeight is supposed to add I’m not seeing any difference with/without the rowHeight set here. override func viewDidLoad() { super.viewDidLoad() tableView.rowHeight = UITableView.automaticDimension tableView.estimatedRowHeight = 65 ..read more
Visit website
Non-text elements in the Kindle version of the book
Big Nerd Ranch Forums
by Tovah
2M ago
The Kindle version contains graphics and other non-text elements such as screenshots, source listings, etc. that are not legible. Where can I get readable images of these elements? Other publishers place the non-text elements of their books at GitHub, the publisher’s website, etc. 2 posts - 2 participants Read full topic ..read more
Visit website
Silver Challenge: Crashing with Either "Invalid Batch Update" or "Invalid update: invalid number of sections"
Big Nerd Ranch Forums
by yanichik
2M ago
I’m getting one of two errors when trying to implement Silver Challenge. When I include reloadDataI() I’m getting the “Invalid batch updates” error below, and when excluding it I’m getting the “Invalid update: invalid number of sections” error. Please assist with some guidance. What I’m trying to do is have 1 section when there are no items, and 2 sections when there are items (where the 2 sections are “50 and under” and “over 50”). Thread 1: "Invalid batch updates detected: the number of sections and/or rows returned by the data source before and/or after performing the batch updates are inc ..read more
Visit website
Confirming to protocol inside view controller programmatically?
Big Nerd Ranch Forums
by MrAgole
2M ago
Hello! No idea if the title makes sense but I am trying to accomplish something like this programmatically. “override func prepare(for segue: UIStoryboardSegue, sender: Any?) { switch segue.identifier { case “embedContainerViewController”: guard let moodsConfigurable = segue.destination as? MoodsConfigurable else { preconditionFailure( “View controller expected to conform to MoodsConfigurable”) } self.moodsConfigurable = moodsConfigurable segue.destination.additionalSafeAreaInsets = UIEdgeInsets(top: 0, left: 0, bottom: 160, right: 0) default: preconditionFailure(“Unexpected segue identifier ..read more
Visit website
Chapter 1, Bronze Challenge
Big Nerd Ranch Forums
by geraldinejns
2M ago
Hello, I’m a newbian. Below is my first challenge in swift programming book. Just want to know if I read the challenge right. var lastName = “Jones” print(lastName) 1 post - 1 participant Read full topic ..read more
Visit website

Follow Big Nerd Ranch Forums on FeedSpot

Continue with Google
Continue with Apple
OR