Re: Create a NSURL as a way to validate urls - not working
Re: Create a NSURL as a way to validate urls - not working
- Subject: Re: Create a NSURL as a way to validate urls - not working
- From: Roland King <email@hidden>
- Date: Tue, 03 Mar 2015 23:27:50 +0800
> On 3 Mar 2015, at 22:42, Juanjo Conti <email@hidden> wrote:
>
> Ok, first of all thanks all for the replies.
>
> I'm trying to solve it this an util class method:
>
> import Cocoa
>
> class Utils: NSObject {
>
> class func isValidUrl(url: NSURL?) {
> var lower = url?.scheme?.lowercaseString
> return lower == "http" || lower == "https"
> }
> }
> Sadly I'm getting and error in the return line that I can't interprete:
> Cannot invoke == with argument list of type `($T4, $T8)`
>
> What I'm doing wrong?
>
Using Swift :)
> Thanks,
If you use the latest beta you get a slightly better error message “Bool is not convertible to ()”, that is one thing that version has fixed, the $T3 variables in error messages, which is a good step forward.
That error message might lead you to realise what I didn’t from the original error message either, that your function definition is missing “->Bool” to give it a return type. Would still prefer an error message which directly said ‘Incorrect return type” but at least this one gave enough hints to figure it out.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden