class XYActivity: UIActivity,YouTubeHelperDelegate
{
var youTubeHelper:YouTubeHelper
var uploadURL: String!
override init() {
self.youTubeHelper = YouTubeHelper()
}
override func activityType() -> String? {
return nil
}
//
}
I want to make uploadURL public, That is, to be assigned in other class.
When I add public infront of var uploadURL:String!
it suggest me to make it as internal. I wanna make it public. Please help
JuST ADD a keyword "public" at start this will make it public in the app.
Here you can see section is a global variable we have defined, inside a class but outside a function. We can use an access modifier prefixed with the global variable as per the need. You can also define a global variables as static by prefixing static keyword.
An open class member is accessible and overridable outside of the defining module. A public class is accessible but not subclassable outside of the defining module. A public class member is accessible but not overridable outside of the defining module.
"use variables from within the function, outside of the function" You can't. They are declared inside the function. So they are temporary, and scoped within the function. If you want something outside the function, pass it out as part of the result, or (less good) declare it outside the function.
You can make it public if the class that contains it is also public, so change that according to it.
JuST ADD a keyword "public" at start this will make it public in the app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With