On Feb 23, 2015, at 1:52 PM, Fritz Anderson fri...@manoverboard.org wrote:
On 23 Feb 2015, at 8:18 AM, Juanjo Conti jjco...@carouselapps.com
mailto:jjco...@carouselapps.com wrote:
I'm translating some code from Objective-C to Swift and in the middle of
that, i found this problem.
Hi!
I'm translating some code from Objective-C to Swift and in the middle of
that, i found this problem.
theUrl is an instance of NSURL
theUrl.host?.lowercaseString
compiles ok.
But
NSString(string: theUrl.host?.lowercaseString)
don't. It says Value of optional type 'String?' no unwrapped;
On Mon, Feb 23, 2015, at 01:48 PM, Marco S Hyman wrote:
lowerCaseString is a non optional property. Therefore it makes no sense
to
write someString.lowercaseString? or someString.lowercaseString!
It's chained through an optional access though. So the type of
foo?.lowercaseString is String?.
On 23 Feb 2015, at 8:18 AM, Juanjo Conti jjco...@carouselapps.com wrote:
I'm translating some code from Objective-C to Swift and in the middle of
that, i found this problem.
theUrl is an instance of NSURL
theUrl.host?.lowercaseString
compiles ok.
But
NSString(string:
On Feb 23, 2015, at 11:52 , Kyle Sluder k...@ksluder.com wrote:
So the type of
foo?.lowercaseString is String?.
Yes, I agree, so the OP’s *original* error message was correct, but the
question is what is the type of ‘foo?.lowercaseString!’, and that depends on
the precedence of the “!”
On Feb 23, 2015, at 1:52 PM, Fritz Anderson fri...@manoverboard.org wrote:
This is written in haste, and few people are experts…
theURL.host may yield nil (host is declared String!, implicitly
unwrapped, but optional).
theURL.host?.lowercaseString will short-circuit and be