Verify the url that can be valid iOS swift
Problem:
I'm having a url that is valid or not to show the user that enter the valid url.How can i achieve that?
Solution:
You can add the function in utils to achieve that.
// MARK: - Verify the URL
func verifyUrl (urlString: String?) -> Bool {
if let urlString = urlString {
if let url = URL(string: urlString) {
return UIApplication.shared.canOpenURL(url)
}
}
return false
}
Comments
Post a Comment