in Education by
Is it possible to get access to dismiss() in an SKScene class? Dismiss is a method available from apples UIKit here is a link to Apple's official documentation on dismiss. class GameScene: SKScene { } Attempting to fire dismiss off from an IBAction example: @IBAction func dismissTapped(_ sender: Any) { //figure out how to dismiss } Dismiss would normally be used like this - dismiss(animated: true, completion: nil) JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
dismiss is a method on UIviewController and not on SKScene. However, your scene does have a view property that is its containing view (which is a SKView, which is a UIView, which is a UIResponder). You can use the view's next method inherited from UIResponder to walk up the responder chain until you hit the first view controller (because UIViewController is also a UIResponder): extension UIResponder { func firstParent(ofType type: T.Type ) -> T? { return next as? T ?? next.flatMap { $0.firstParent(ofType: type) } } } //Use in your SKScene like so view?.firstParent(ofType: UIViewController.self)?.dismiss(animated: true, completion: nil)

Related questions

0 votes
    I am writing my first iOS application (iPhone only) with Swift. The main application view should allow user ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 29, 2022 in Education by JackTerrance
0 votes
    Can anyone help me, Im trying to make a simple app where you touch the screen and 4 images are ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    Can anyone help me, Im trying to make a simple app where you touch the screen and 4 images are ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 3, 2022 in Education by JackTerrance
0 votes
    I have a UITableView inside a UITableViewCell (Scrolling is disabled for the nested UITableView) Everything works ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 3, 2022 in Education by JackTerrance
0 votes
    I have a UITableView inside a UITableViewCell (Scrolling is disabled for the nested UITableView) Everything works ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 26, 2022 in Education by JackTerrance
0 votes
    I have a UITableView inside a UITableViewCell (Scrolling is disabled for the nested UITableView) Everything works ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 18, 2022 in Education by JackTerrance
0 votes
    I make an alarm clock app, and I want when my device is locked and alarm start calling see a ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 3, 2022 in Education by JackTerrance
0 votes
    I am using Realm with Swift 3 in my iOS app. I have the following code //Find all records for the day func ... { let predicate = NSPredicate(format: "date >= %@ and date...
asked May 8, 2022 in Education by JackTerrance
0 votes
    Recently implemented trailingSwipeActionsConfigurationForRowAt , where after swiping from right to left showing two options ... , JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    I've inherited a codebase that implements a half-baked implementation of custom intents and shortcuts. One ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    I'm making a little game and I'am having trouble updating an UILabel I created to display the current ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    I want to show in an alert a french sentence containing accentuated letters such as "é" and "à". ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    I want to show in an alert a french sentence containing accentuated letters such as "é" and "à". ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    I want to show in an alert a french sentence containing accentuated letters such as "é" and "à". ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    I want to show in an alert a french sentence containing accentuated letters such as "é" and "à". ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
...