I am looking to do this in Swift 2.x: Say I enter text in a textfield. - 'Apple iPhone http://www.apple.com'
I am now updating a UIButton with label - Apple iPhone. And I want the IBAction when the button is clicked to launch 'http://www.apple.com.
I can set this up, but the part where I am having trouble is - How do I parse 'Apple iPhone' and 'http://www.apple.com' from the textfield and separate them so I can update the UIButton label with some text and use the URL for launching Safari ? More specifically, I want to be able to to detect any 'text' followed by 'http://', and always use the text to update a label and the http to launch a browser with the url. Thanks for answering.