> On 2 Mar 2015, at 23:22, Juanjo Conti <jjco...@carouselapps.com> wrote: > > According the docs ( > https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/) > NSURL(string: aString) will return nil if aString is malformed. > > But I've tried this in the a playground and no nil is returned: > > NSURL(string: "")! > NSURL(string: "ssss")! > > Why is this? are the docs wrong?
Go read the specs NSURL references. An empty string and “ssss” are both valid by its definition. Pretty much all NSURL is looking for is you’re not using any unsupported characters, or mis-using reserved characters. Anything more, and you’ve got to test the resulting URL yourself. Perhaps you can elaborate what you consider to be a valid URL in your case. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com