Post

Replies

Boosts

Views

Activity

Reply to Using Fruit Basket demo
I'm still unsure about a lot of things. The best way to use this forum is to ask questions, one by one. If you do so, don't forget to post the relevant piece of code and explain clearly what doesn't work as expected or what you don't understand. Note: could you post the link to the WWDC21 session ?
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’21
Reply to Need Help Transfer Data From Button
gives me an unrecognized selector error Which line ? You need to retrieve the item, which is the selected cell. You can do this in didSelectRow to keep the selectedCell reference. Or you could also extract there item.yahooName and keep it in a var selectedName in VC and use it in prepare.
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’21
Reply to Need Help Transfer Data From Button
Another point: don't force downcast. If it fails, app will crash   let destinationController = segue.destination as! HighlightsVC       destinationController.playerName = (item.yahooName!) But conditionnal unwrap: if  let destinationController = segue.destination as? HighlightsVC {       destinationController.playerName = selectedName // Set in didSelectRow } No need either for parenthesis around name, but for such code, use ?? operator:       destinationController.playerName = item.yahooName ?? ""
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’21
Reply to Need Help Transfer Data From Button
The thing is I don't want the whole cell to be selected. I just want the button to be. When you tap the button, de facto you select cell. So probably you can use optional func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? to get the select and immediately deselect it so that it is not highlighted. But in the meantime, get the cell reference and name.
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’21
Reply to Need Help Transfer Data From Button
what you mean by cell reference In willSelectRowAt, you can either get the cell itself or you can directly get the yahooName of the cell. And save it in a global var of the VC. Then, the segue is from the VC (not the cell) to the next VC. In prepare, you set the name as you have done. In IBAction, just call the segue: @IBAction func CamButtonA(_ sender: UIButton) {           performSegue(withIdentifier: "hs", sender: nil) // No need to know the sender here }
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’21
Reply to HELP! I don't understand Loops.
What is it more precisely you don't understand ? It it the for loop, the while loop ? Is it something specific in the syntax ? Please give examples of what you don't understand, we'll try to help. Note: you should use Apple book: intro to App development with Swift or, more detailed: The Swift programming language. They are much more didactic and will ease your understanding.
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’21
Reply to Swift Playground Not Working
That should work. Which version of Xcode ? Could you test with : Swift.print(greeting) And tell what you get ? Check also in Xcode Preferences, in case you have set a white font for the console: Otherwise, could you attach the full playground project so that one can investigate ?
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’21