• 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
Any way to combine for and if-let?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Any way to combine for and if-let?


  • Subject: Any way to combine for and if-let?
  • From: Rick Mann <email@hidden>
  • Date: Tue, 07 Jul 2015 16:42:08 -0700

Is there any way to combine the for and if-let into one line that gives me unwrapped NSURL objects to work on? I believe the enumerator (which came from NSFileManager) will only have valid NSURLs in it.

    for item in enumerator!
    {
        if let url = item as? NSURL
        {
            let sid = url.lastPathComponent!
            print("Found: \(sid), \(url.path)")
            processModel(url)
        }
    }


--
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: Any way to combine for and if-let?
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: selectText of NSTextField on focus
  • Next by Date: Re: Any way to combine for and if-let?
  • Previous by thread: Re: Sizing NSScrollView width to exactly fit NSTableView
  • Next by thread: Re: Any way to combine for and if-let?
  • Index(es):
    • Date
    • Thread