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

Vladimir.S svabox at gmail.com
Tue Apr 19 01:40:07 CDT 2016


+1 IMO Date should be one of the standard type in Swift, like String, 
Array, Dictionary etc. And of course, it should be implemented as structure 
like any other base types in swift. It is very strange that NSDate(Date) 
was not introduced as standard type for Swift 3.0. But instead we are 
working on renaming methods and other low-priority tasks.

On 19.04.2016 5:31, Emanuel Andrada via swift-evolution wrote:
> 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
> Thoughts?
> Emanuel
>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>


More information about the swift-evolution mailing list