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

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift