I have an NSString with an URL, in this way:
http://someurl.com/something
How would I get someurl.com
only?
I\'ve already trie
Swift 4
And if you are using Custom url schemes say for deeplinking, for eg:
myapp:homescreen
(and don't have the "forward slashes with host name" (//www.bbc)), one solution that worked for me to extract "homescreen" is by using the index
method below and then pattern matching
to scrape everything after ":"
let index = absoluteString.index(absoluteString.startIndex, offsetBy: 5)
String(absoluteString[index...])
url.host
or absoluteURL.host
is nil
in this scenario