Simple Swift question
Simple Swift question
- Subject: Simple Swift question
- From: Rick Mann <email@hidden>
- Date: Mon, 29 Jun 2015 15:23:02 -0700
Oh, I think I figured it out. NSURL(string:) is optional, but NSURLRequest(URL:) can't. Very unexpected, and the error message I was getting did not clue me in.
---------
How are you supposed to do simple things like this, succinctly?
let url = NSURL(string: "<some url>")
let req = NSURLRequest(URL: url)
self.webView.loadRequest(req)
This, obviously, doesn't work, since the results are optionals, and so need to be unwrapped. But it gets rapidly ridiculous with a bunch of nested if-lets (imagine you had more than just two operations to get from here to there). What's the right way to do this?
--
Rick Mann
email@hidden
_______________________________________________
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