[swift-evolution] NSDate as struct in Swift Foundation (swift 3)

Emanuel Andrada emanuel at aijunasys.com.ar
Mon Apr 18 21:31:17 CDT 2016


Hi all,
this is my first contribution here. I tried to track down if someone has posted something similar but I couldn’t find any mail.
My proposal consists on making NSDate (or Date after the prefix removal) a struct instead of a class. I know that it was probably modeled as a class to keep compatibility with NSDate from Cocoa, but I think it feels more natural to model it as a struct in Swift (or even a typealias for Double, just like NSTimeInterval).
I know that the bridging with Cocoa could be an issue, but String is a struct and is bridged just fine to NSString. Obviously, I am probably missing something about the implementation of something like that.
Here is a link to NSDate in swift-corelibs-foundation: https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSDate.swift <https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSDate.swift>
Thoughts?
Emanuel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160418/bea7d5c9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160418/bea7d5c9/attachment.sig>


More information about the swift-evolution mailing list