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

Re: Any way to combine for and if-let?


  • Subject: Re: Any way to combine for and if-let?
  • From: Roland King <email@hidden>
  • Date: Wed, 08 Jul 2015 08:30:59 +0800

> On 8 Jul 2015, at 08:26, Quincey Morris <email@hidden> wrote:
>
> On Jul 7, 2015, at 16:58 , Rick Mann <email@hidden> wrote:
>>
>> Also, the enumerator is a NSDirectoryEnumerator. It returns AnyObject type, so wouldn't there have to be an NSURL cast in there somewhere?
>
>
> Try:
>
>> for case let url as NSURL in enumerator
>

Two obersvations

1) If you’re sure it’s not nil, which for that particular case of an enumerator from a filemanager I’d agree it’s not (can’t make one work in a playground to test) then just force-unwrap it
2) As concise as ‘for case let url as NSURL in eumerator’ is, I think the original code was somewhat clearer for the next guy maintaining it


_______________________________________________

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: Rick Mann <email@hidden>
References: 
 >Any way to combine for and if-let? (From: Rick Mann <email@hidden>)
 >Re: Any way to combine for and if-let? (From: Quincey Morris <email@hidden>)
 >Re: Any way to combine for and if-let? (From: Rick Mann <email@hidden>)
 >Re: Any way to combine for and if-let? (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Any way to combine for and if-let?
  • Next by Date: Re: Any way to combine for and if-let?
  • Previous by thread: Re: Any way to combine for and if-let?
  • Next by thread: Re: Any way to combine for and if-let?
  • Index(es):
    • Date
    • Thread