Get the domain part of an URL string?
Objective-C
NSString* urlString = @"http://someurl.com/something";
NSURL* url = [NSURL URLWithString:urlString];
NSString* domain = [url host];
Swift 2
var urlString = "http://someurl.com/something"
var url = NSURL(string: urlString)
var domain = url?.host
Swift 3+
var urlString = "http://someurl.com/something"
var url = URL(string: urlString)
var domain = url?.host
Use
[[NSURL URLWithString:@"http://someurl.com/something"] host]