Reference to a TableView Delegate Object within a Scene in Swift 4

Multi tool useReference to a TableView Delegate Object within a Scene in Swift 4
I have a tableview in a SpriteKit scene. Using a tableview delegate method, I like to pass to another scene/ViewController, which cell was selected. There is only a single storyboard as this is entirely a SpriteKit game.
//TableView inside Scene & Delegate Protocol:
protocol gameSelectedDelegate {
func theGameSelected(gameInt: Int)
}
class GamesTableView: UITableView, UITableViewDelegate,UITableViewDataSource {
//Test Data
var items: [String] = ["Player1", "Player2"]
let defaults = UserDefaults.standard
var gamesList = [Game]()
var passedGame: Int?
//instance of delegate
var selectionDelegate: gameSelectedDelegate!`
//GameScene to receive tableview data and delegate for my tableview
class GamePlay: SKScene, gameSelectedDelegate {
var backButton = SKLabelNode(fontNamed: "ArialRoundedMTBold")
var score = SKLabelNode(fontNamed: "ArialRoundedMTBold")
var passedGame = 0 //Not getting passed from LoadGame
var passedGameDelegate:Int? = nil
override func sceneDidLoad() {
let grid = childNode(withName: "grid")
grid?.zPosition = 1
self.backgroundColor = UIColor.black
let sc = GamesTableView.self //How do I get a reference to my tableview?
sc.selectionDelegate = self
UITableView
UIViewController
UITableView
UITableViewController
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Ttq,nKltAnwn
Popular posts from this blog
Clash Royale CLAN TAG #URR8PPP
Boo Paradigm Object oriented Designed by Rodrigo B. De Oliveira Developer Rodrigo B. De Oliveira First appeared 2003 ; 15 years ago ( 2003 ) Stable release 0.9.7 / 25 March 2013 ; 5 years ago ( 2013-03-25 ) Typing discipline static, strong, inferred, duck Implementation language C# Platform Common Language Infrastructure (.NET Framework & Mono)/ License BSD 3-Clause [1] Website github.com/boo-lang , boo-lang.org Influenced by C#, Python Influenced Genie, Vala Boo is an object-oriented, statically typed, general-purpose programming language that seeks to make use of the Common Language Infrastructure's support for Unicode, internationalization, and web applications, while using a Python-inspired syntax [2] and a special focus on language and compiler extensibility. Some features of note include type inference, generators, multimethods, optional duck typing, macros, true closures, currying, and first-class functions. Boo was one of the three scriptin...
"House of Rothschild" redirects here. For the film, see The House of Rothschild. For other uses, see Rothschild (disambiguation). Rothschild Jewish noble banking family Coat of arms granted to the Barons Rothschild in 1822 by Emperor Francis I of Austria Ethnicity Jewish Current region Western Europe (mainly United Kingdom, France, and Germany) [1] Etymology Rothschild (German): "red shield" Place of origin Frankfurter Judengasse, Frankfurt, Holy Roman Empire Founded 1760s (1577 ( 1577 ) ) Founder Mayer Amschel Rothschild (1744–1812) (Elchanan Rothschild, b. 1577) Titles List Freiherr von Rothschild (1822) Baronet, of Tring Park (1847) Baron Rothschild (1885) Traditions Judaism, Goût Rothschild Motto Concordia, Integritas, Industria (English: Harmony, Integrity, Industry ) Estate(s) List British properties Château de Ferrières Palais Rothschild Cadet branches List Austrian branch English branch French branch Neapolitan branch A Rothschild house,...
Your question isn't very clear. Why did you subclass
UITableView
? You either want to subclassUIViewController
and put aUITableView
in it, or you want to subclassUITableViewController
. How do the table view and the sprite kit scenes relate?– Paulw11
Jul 2 at 2:15