Before you down vote, I haven't found anything that looks like this.
So i made a few text files, each is labeled a specific number(corresponding to the day of the month). Each text file has a quote embedded inside. I had it such that when the button is pressed on the view the label that says "Historical" changes to that quote.
Here is the code:
@IBAction func UpdateHistorical(sender: AnyObject) {//step 1
let a = NSCalendar.currentCalendar().component(.Day, fromDate: NSDate())
HistoricalLabel.text = String(a)
var n = ""
n = String(a)
let hImage = UIImage.init(named: n)
HistoricalImage.image = hImage
//Below is the part that matters above was to just give context
let path = NSTemporaryDirectory()+"1.txt"
let readFile = try? String(contentsOfFile: path, encoding: NSUTF8StringEncoding)
HistoricalLabel.text = readFile
}
}
Here is an image of the view after execution:
What am I doing wrong?