[swift-corelibs-dev] Making Foundation classes easier for Swift development

Ryan Breaker ryan at breaker.rocks
Mon Feb 1 13:00:39 CST 2016


Hello Swift team and contributors!

I have been wondering about how existing Foundation classes, structs, and such types will be eventually adapted for use in Swift; I understand that, for example, the “NS”-prefix will be removed sometime in Swift 3. What I have been working with most recently has been NSFileManager and its `attributesOfItemAtPath` method which returns a type of [String: AnyObject]. Due to the nature of this, I’ve had to do some digging into the existing corelib-foundation source of NSFileManager to see how each item is assigned and which ones are guaranteed to be set and which ones I should be cautious of (e.g. could be nil).

So that said, are there any plans or thoughts on either changing current types, such as the return type of the aforementioned method, or adding new types to supplement things like this better? For the time being I have written my own small Swift module <https://github.com/RyanBreaker/SwiftFileAttributes> for handling this easier, but I can’t help but feel edgy about it with all the explicit optional unwrapping.

Thanks,
Ryan Breaker
ryan at breaker.rocks <mailto:ryan at breaker.rocks>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20160201/fa394775/attachment.html>


More information about the swift-corelibs-dev mailing list