# iOSViewscreen passing parameters

**URL:** <https://ifnotnil.com/t/iosviewscreen-passing-parameters/728>\
**Category:** iOS\
**Created:** [11 July 2020 01:38 UTC](https://ifnotnil.com/t/iosviewscreen-passing-parameters/728 "2020-07-11T01:38:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![supcumps](https://ifnotnil.com/user_avatar/ifnotnil.com/supcumps/32/362_2.png) [@supcumps](https://ifnotnil.com/u/supcumps)\
**Post date:** [11 July 2020 01:38 UTC](https://ifnotnil.com/t/iosviewscreen-passing-parameters/728/1 "2020-07-11T01:38:50Z")

</div>

I am having trouble passing parameters between two screens. I enter fields in the first view, then call a secondary view to make some calculations to produce a value in a secondary view. The result is then copied to a global variable and I return to the initial view using the backarrow. I can show that the global variable contains the value I need to enter into a field in the first screen, bit cannot figure out how to get that value into the text field I want it to be entered into. The text field has only three event handlers, Open, Close and Text Change. None seem helpful.  
Does anyone have any advice on the best way to overcome this issue?  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![DaveS](https://ifnotnil.com/user_avatar/ifnotnil.com/daves/32/79_2.png) [@DaveS](https://ifnotnil.com/u/DaveS)\
**Post date:** [11 July 2020 04:57 UTC](https://ifnotnil.com/t/iosviewscreen-passing-parameters/728/2 "2020-07-11T04:57:10Z")

</div>

sorry… if you were doing this in Swift I might be able to help

---

<div class="post-metadata">

**Author:** ![supcumps](https://ifnotnil.com/user_avatar/ifnotnil.com/supcumps/32/362_2.png) [@supcumps](https://ifnotnil.com/u/supcumps)\
**Post date:** [11 July 2020 05:04 UTC](https://ifnotnil.com/t/iosviewscreen-passing-parameters/728/3 "2020-07-11T05:04:59Z")

</div>

Thanks Dave,  
I always appreciate your contributions. I guess I will get back to writing in swift sometime, but Xojo is mostly OK for now…

---

<div class="post-metadata">

**Author:** ![supcumps](https://ifnotnil.com/user_avatar/ifnotnil.com/supcumps/32/362_2.png) [@supcumps](https://ifnotnil.com/u/supcumps)\
**Post date:** [11 July 2020 05:41 UTC](https://ifnotnil.com/t/iosviewscreen-passing-parameters/728/4 "2020-07-11T05:41:35Z")

</div>

Jeff Tullin helped me out on the other forum.  
He pointed out that I could use the activate() event on the first view to modify a text field to show the value the global variable changed in. the secondary view.

---

<div class="post-metadata">

**Author:** ![TomBaumgartner](https://ifnotnil.com/user_avatar/ifnotnil.com/tombaumgartner/32/427_2.png) [@TomBaumgartner](https://ifnotnil.com/u/TomBaumgartner)\
**Post date:** [12 July 2020 13:20 UTC](https://ifnotnil.com/t/iosviewscreen-passing-parameters/728/5 "2020-07-12T13:20:19Z")

</div>

This may not be recommended but I use this all the time in my iOS apps. When View A is Opened I store a reference to it in an App property such as pViewA as iOSView (App.pViewA=self). Then when View B does something that it wants to pass to View A it can do so by referencing the App property. For maximum object oriented style I would create a method in View A such as UpdateTextField(newText). Then View B would call App.pViewA.UpdateTextField(newText).

---

<div class="post-metadata">

**Author:** ![supcumps](https://ifnotnil.com/user_avatar/ifnotnil.com/supcumps/32/362_2.png) [@supcumps](https://ifnotnil.com/u/supcumps)\
**Post date:** [12 July 2020 21:29 UTC](https://ifnotnil.com/t/iosviewscreen-passing-parameters/728/6 "2020-07-12T21:29:19Z")

</div>

Thanks. I saw a reference to using objects with global scope. Sounds like your method is similar and a useful tip for future projects.
