So I have a navigation bar and would like to be able to change it's title and display the contents of a text file as the title. I was going to use this code to get access to the title self.navigationItem.title = "YourTitle"
and wanted to know if anyone could workout how I could blend the following code which retrieves from a text file:
let descriptionTextUrl = NSURL(string: "https://wordpress.org/plugins/about/readme.txt")
let descriptionTextRequest = NSURLRequest(URL: descriptionTextUrl!)
NSURLConnection.sendAsynchronousRequest(descriptionTextRequest, queue: NSOperationQueue.mainQueue()) {
(response, data, error) in
dispatch_async(dispatch_get_main_queue())
{self.DescriptionText.text = NSString(data: data, encoding: NSUTF8StringEncoding)! as String
return}
Thanks
It was simply a matter of replacing the
self.DescriptionText.text =
with theself.navigationItem.title =
This was the complete code: