I need some advice on the global declaration of variables (and hopefully functions)
What is the difference between declaring a variable like
import Foundation
var myglobalvariable = ""
and
import Foundation
struct globalvariablestruct
{
static var myglobalvariable = ""
}
and
import Foundation
class globalstructoperation {
struct glovalVariable {
static var myglobalvariable = ""
}
}
Also, I have an API, that is used around 5 times in different view controllers, would it be ok to declare it as a global function?
import Foundation
import Alamofire
func myapicall()
{
//stuff
}
Will Apple reject an app if there are (a lot of) global variables/functions?
What would be the best way to pass variables between several ViewControllers? Also, there are some variables which are used on 90% of the ViewControllers, is it OK if I declare those are global variables?