• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Simple Swift question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple Swift question


  • Subject: Simple Swift question
  • From: Rick Mann <email@hidden>
  • Date: Mon, 29 Jun 2015 15:18:18 -0700

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


  • Follow-Ups:
    • Re: Simple Swift question
      • From: Greg Parker <email@hidden>
    • Re: Simple Swift question
      • From: Charles Srstka <email@hidden>
  • Prev by Date: Re: Cheating a synchronous call on the main thread
  • Next by Date: Simple Swift question
  • Previous by thread: Re: Cheating a synchronous call on the main thread
  • Next by thread: Re: Simple Swift question
  • Index(es):
    • Date
    • Thread