Re: Noob Swift frustration with dicts and optionals
Re: Noob Swift frustration with dicts and optionals
- Subject: Re: Noob Swift frustration with dicts and optionals
- From: Marco S Hyman <email@hidden>
- Date: Wed, 17 Sep 2014 15:37:00 -0700
>
> The message still seems wrong, though: the operand of the "?" is the dict lookup, which _is_ optional.
Many Swift error messages leave me scratching my head. My latest
head scratcher was this:
func someFunc() -> String {
return "foo"
}
let key = someFunc()
switch key {
case "foo", "bar", "baz":
println(key)
default:
println("Key not found")
}
Works fine. But when someFunc (in another file) changes to return
a "String?" instead of a "String" the compiler tells me that "foo",
"bar", and "baz" does not conform to protocol 'IntervalType'.
Marc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden