Ok, I wanted to validate that the url is an absolute one. Is there something in Swift standard lib to do this?
Thanks in advance! On Mon, Mar 2, 2015 at 7:46 PM, Mike Abdullah <mabdul...@karelia.com> wrote: > > > 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. > > -- Juanjo Conti <jjconti <http://goog_2023646312>@carouselapps.com <jjco...@carouselapps.com>> Software Engineer - Carousel Apps <https://carouselapps.com> -- Carousel Apps Limited, registered in England & Wales with registered number 7689440 and registered office Unit 2 Artbrand Studios, 7 Leathermarket Street, London SE1 3HN. Any communication sent by or on behalf of Carousel App Ltd or any of its subsidiary, holding or affiliated companies or entities (together "Watu") is confidential and may be privileged or otherwise protected. If you receive it in error please inform us and then delete it from your system. You should not copy it or disclose its contents to anyone. Messages sent to and from Watu may be monitored to ensure compliance with our internal policies and to protect our business. Emails are not secure and cannot be guaranteed to be error free. Anyone who communicates with us by email is taken to accept these risks. _______________________________________________ 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