I misunderstood the release notes for Xcode 8 beta 6 I read a few days ago. 
Here what will interest you:

Since ‘id’ now imports as ‘Any’ rather than ‘AnyObject’, you may see errors 
where you were previously performing dynamic lookup on ‘AnyObject’. For example 
in:

      guard let fileEnumerator = FileManager.default.enumerator(atPath: path)
      else {
return }

      for fileName in fileEnumerator {
          if fileName.hasSuffix(".txt") {
              // error: value of type ‘Element’ (aka ‘Any’) has no member
      hasSuffix
              print(fileName)
          }
}
The fix is to either cast to AnyObject explicitly before doing the dynamic 
lookup, or force cast to a

specific object type:

      guard let fileEnumerator = FileManager.default.enumerator(atPath: path)
      else {
return }

      for fileName in fileEnumerator {
          if (fileName as AnyObject).hasSuffix(".txt") {
              // cast to AnyObject
              print(fileName)
          }
}

(27639935) 



> On 25 Aug 2016, at 10:32, Quinn The Eskimo! via swift-users 
> <swift-users@swift.org> wrote:
> 
> 
> On 25 Aug 2016, at 09:27, David Hart <da...@hartbit.com> wrote:
> 
>> That proposal also says:
> 
> Indeed.  Good point.
> 
>> What was decided concerning that?
> 
> I don’t know, although given that that text was from the “Future Directions” 
> section it seems like that nothing has changed yet.
> 
> Share and Enjoy
> --
> Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
> 
> 
> _______________________________________________
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to