Hi,
I've created a property which i can set:
import Foundation
class Settings {
var _viewWards:String = ""
var viewWards:String {
get {
if _viewWards == "" {_viewWards = "http://..."
return _viewWards
}
set (newVal) {}
}
}In the first view controller i set the value based on user inputting the url:
var settings:Settings!
@IBAction func btnLoadWebServiceDataClick(_ sender: UIButton) {
settings.viewWards = txtWSAddress.text!
}But when another button is clicked, the second view controler calls a service class, but has the init value, not the updated one:
var settings:Settings!
import Foundation
class WardService {
var settings:Settings!
init() {
self.settings = Settings()
}
/
func getWards(_ callback:@escaping ([String: Any]) ->()){
request(settings.viewWards, callback: callback)
}Is this the correct way to go about this, or do i need a different approach. Appologies as im relatively new to iOS
If you need more clarification, please let me know
Thanks
Mark