strong Reference to Custom SCNScene is keeping it from deinitUIScrollView cannot display image either in Portrait or Landscape modeSwift SpriteKit ARC for dummiesAVaudioplayer audio player progess as Uislider crashesTableView not displaying text with JSON data from API callAdding a custom UIViewcontroller to subview programmatically but getting an error message “Cannot convert value of type…”Retain cycle trouble when transitioning between scenesiOS addGestureRecognizer with cancelsTouchesInView = false does not work with subview buttonsSwift Error - Use of undeclared type 'cell' - Collection ViewSwift vertical UICollectionView inside UITableViewBMI app print result is 0 even with variable being hard coded

Can an Area of Effect spell cast outside a Prismatic Wall extend inside it?

Thesis on avalanche prediction using One Class SVM

Are there physical dangers to preparing a prepared piano?

bldc motor, esc and battery draw, nominal vs peak

Checks user level and limit the data before saving it to mongoDB

What are the steps to solving this definite integral?

What is the most expensive material in the world that could be used to create Pun-Pun's lute?

What causes platform events to fail to be published and should I cater for failed platform event creations?

How to fry ground beef so it is well-browned

How does Captain America channel this power?

How to denote matrix elements succinctly?

Why did some of my point & shoot film photos come back with one third light white or orange?

Can we say “you can pay when the order gets ready”?

What term is being referred to with "reflected-sound-of-underground-spirits"?

Function pointer with named arguments?

a sore throat vs a strep throat vs strep throat

How to have a sharp product image?

Who was the lone kid in the line of people at the lake at the end of Avengers: Endgame?

Retract an already submitted recommendation letter (written for an undergrad student)

How did Captain America manage to do this?

Mistake in years of experience in resume?

Was there a shared-world project before "Thieves World"?

"You've called the wrong number" or "You called the wrong number"

How do I reattach a shelf to the wall when it ripped out of the wall?



strong Reference to Custom SCNScene is keeping it from deinit


UIScrollView cannot display image either in Portrait or Landscape modeSwift SpriteKit ARC for dummiesAVaudioplayer audio player progess as Uislider crashesTableView not displaying text with JSON data from API callAdding a custom UIViewcontroller to subview programmatically but getting an error message “Cannot convert value of type…”Retain cycle trouble when transitioning between scenesiOS addGestureRecognizer with cancelsTouchesInView = false does not work with subview buttonsSwift Error - Use of undeclared type 'cell' - Collection ViewSwift vertical UICollectionView inside UITableViewBMI app print result is 0 even with variable being hard coded






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















In my ViewController I declare a UIGesturerecognitzer like this :



 var scnView : SCNView!

override func viewdidload
let swipeDownGesture = UISwipeGestureRecognizer(target: self, action: #selector(handleswipedown(_:)))
swipeDownGesture.direction = .down
scnView.addGestureRecognizer(swipeDownGesture)

@objc
func handleswipedown(_ gestureRecognize: UIGestureRecognizer)
if movingallowed == true
if let scene = scnView.scene as! GameScene
scene.swipedDown()





GameScene is a custom SCNScene Class.



After the Player is done with the Level, I would like to present the next GameScene and deinit the last one, but it doesn't deinit. When I comment out the GestureRecognizer, it does though.



I think this is because I create a strong reference here:



if let scene = scnView.scene as! GameScene 
scene.swipedDown()



My Question is, how do I make this a weak reference?



Thank you in advance










share|improve this question
























  • func viewdidload – did you post your actual code?

    – Martin R
    Mar 9 at 10:01











  • Yes besided that part(i was lazy).

    – Hergen Lehmann
    Mar 9 at 15:58

















0















In my ViewController I declare a UIGesturerecognitzer like this :



 var scnView : SCNView!

override func viewdidload
let swipeDownGesture = UISwipeGestureRecognizer(target: self, action: #selector(handleswipedown(_:)))
swipeDownGesture.direction = .down
scnView.addGestureRecognizer(swipeDownGesture)

@objc
func handleswipedown(_ gestureRecognize: UIGestureRecognizer)
if movingallowed == true
if let scene = scnView.scene as! GameScene
scene.swipedDown()





GameScene is a custom SCNScene Class.



After the Player is done with the Level, I would like to present the next GameScene and deinit the last one, but it doesn't deinit. When I comment out the GestureRecognizer, it does though.



I think this is because I create a strong reference here:



if let scene = scnView.scene as! GameScene 
scene.swipedDown()



My Question is, how do I make this a weak reference?



Thank you in advance










share|improve this question
























  • func viewdidload – did you post your actual code?

    – Martin R
    Mar 9 at 10:01











  • Yes besided that part(i was lazy).

    – Hergen Lehmann
    Mar 9 at 15:58













0












0








0








In my ViewController I declare a UIGesturerecognitzer like this :



 var scnView : SCNView!

override func viewdidload
let swipeDownGesture = UISwipeGestureRecognizer(target: self, action: #selector(handleswipedown(_:)))
swipeDownGesture.direction = .down
scnView.addGestureRecognizer(swipeDownGesture)

@objc
func handleswipedown(_ gestureRecognize: UIGestureRecognizer)
if movingallowed == true
if let scene = scnView.scene as! GameScene
scene.swipedDown()





GameScene is a custom SCNScene Class.



After the Player is done with the Level, I would like to present the next GameScene and deinit the last one, but it doesn't deinit. When I comment out the GestureRecognizer, it does though.



I think this is because I create a strong reference here:



if let scene = scnView.scene as! GameScene 
scene.swipedDown()



My Question is, how do I make this a weak reference?



Thank you in advance










share|improve this question
















In my ViewController I declare a UIGesturerecognitzer like this :



 var scnView : SCNView!

override func viewdidload
let swipeDownGesture = UISwipeGestureRecognizer(target: self, action: #selector(handleswipedown(_:)))
swipeDownGesture.direction = .down
scnView.addGestureRecognizer(swipeDownGesture)

@objc
func handleswipedown(_ gestureRecognize: UIGestureRecognizer)
if movingallowed == true
if let scene = scnView.scene as! GameScene
scene.swipedDown()





GameScene is a custom SCNScene Class.



After the Player is done with the Level, I would like to present the next GameScene and deinit the last one, but it doesn't deinit. When I comment out the GestureRecognizer, it does though.



I think this is because I create a strong reference here:



if let scene = scnView.scene as! GameScene 
scene.swipedDown()



My Question is, how do I make this a weak reference?



Thank you in advance







swift reference scnscene






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 9 at 13:46









Kaushik Makwana

1,031723




1,031723










asked Mar 9 at 8:57









Hergen LehmannHergen Lehmann

86




86












  • func viewdidload – did you post your actual code?

    – Martin R
    Mar 9 at 10:01











  • Yes besided that part(i was lazy).

    – Hergen Lehmann
    Mar 9 at 15:58

















  • func viewdidload – did you post your actual code?

    – Martin R
    Mar 9 at 10:01











  • Yes besided that part(i was lazy).

    – Hergen Lehmann
    Mar 9 at 15:58
















func viewdidload – did you post your actual code?

– Martin R
Mar 9 at 10:01





func viewdidload – did you post your actual code?

– Martin R
Mar 9 at 10:01













Yes besided that part(i was lazy).

– Hergen Lehmann
Mar 9 at 15:58





Yes besided that part(i was lazy).

– Hergen Lehmann
Mar 9 at 15:58












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55075633%2fstrong-reference-to-custom-scnscene-is-keeping-it-from-deinit%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55075633%2fstrong-reference-to-custom-scnscene-is-keeping-it-from-deinit%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

Алба-Юлія

Захаров Федір Захарович