Need to convert array of string value to array of URL. Some one help me to convert the String array to URL array in swift.
let urls = ["www.1.com", "www.1.com", "www.1.com", "randomSmth"].compactMap { URL(string: $0) }
"compactMap" ensures that it just ignores invalid urls.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With