0

Let's say:

  1. I have class String containing an empty string variable a
  2. In page 1, I need to set variable a = "string here"
  3. In page 2, I need to call the value of a

How can I do that?

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
HoangManh
  • 9
  • 1
  • 7
  • means you want to pass the value from page 1 to page 2? – BHAVIK Oct 26 '17 at 09:44
  • what is _'page'_ in this context? – holex Oct 26 '17 at 09:58
  • page: import UIKit class APIurl { var loginURL = "" var trackingURL = "" var playbackURL = "" var feedbackURL = "" var geofenURL = "" } – HoangManh Oct 26 '17 at 10:06
  • page2: if item == "vnetgps.com" { self.api.trackingURL = "http://api.vnetgps.com:8000/tracking" self.api.playbackURL = "http://api.vnetgps.com:8000/playback" self.api.geofenURL = "http://api.vnetgps.com:8000/geofence" self.api.feedbackURL = "http://api.vnetgps.com:8000/feedback" //let nextview = self.storyboard?.instantiateViewController(withIdentifier: <#T##String#>) as! APIurl // nextview.loginURL = "http://api.vnetgps.com:8000/trackin } – HoangManh Oct 26 '17 at 10:07
  • Incorporate those comments into the question and you may get off of the Very Low Quality review queue where I found it. At least you'll have some code to show some effort which your current post certainly doesn't. – Mark Fitzgerald Oct 26 '17 at 12:14

1 Answers1

0

from page 1

   let nextview = self.storyboard?.instantiateViewController(withIdentifier: "Page2Identifier") as! Page1Controller
nextview.prevscreen = a
        self.navigationController?.pushViewController(nextview, animated: true)

in Page 2

var prevscreen = ""
BHAVIK
  • 890
  • 7
  • 35