Permanent declaration in quick
6 answers
First create the structure
struct AStructConstants
{
static let sampleString : NSString = NSString(string: "Check out what I learned about %@ from Stackoverflow.")
}
var aString : NSString = NSString(format: AStructConstants.sampleString, "some custom text")
println(aString)
Your result will be:
Check out what I learned about some custom text from Stackoverflow.
-2
source to share
let msg = "It time to take your" as String
let alertController = UIAlertController(title: "iOScreator", message:
"\(msg)" , preferredStyle: UIAlertControllerStyle.Alert)
alertController.addAction(UIAlertAction(title: "Dismiss", style: UIAlertActionStyle.Default,handler: nil))
self.presentViewController(alertController, animated: true, completion: nil)
This is how I am warning in Swift. If I am not mistaken and this code is useful for you, I will be glad. :)
+1
source to share
You can not. You will need to make a function out of it:
func notificationMessage(medicineString: String) -> String {
return "It time to take your " + medicineString
}
For more information, this thread reads pretty well.
0
source to share