The community is creating some incredible analyses and writing about Swift. What I keep asking myself whenever learning and reading about Swift is: how likely is this to change soon?
This document is an attempt to gather the Swift features that are still in flux and likely to change.
To contribute just fork this project and add a section below (don't forget to update the Table of Contents!).
- Arrays
- Character
- Numerical data type conversion
- Optionals for values conforming to the LogicValue protocol
- Access control
- C++ support
- Exceptions
- Usage of @-sign in front of keywords
- Absence of math.h macros
- Unowned references breaking in Beta 2
Array semantics were in flux at the time of Beta 1, and have been revised to provide full value semantics like Dictionary and String. This will be available in later betas.
-- Chris Lattner
Sources: https://devforums.apple.com/thread/228695?start=75&tstart=
Note that Character is still evolving and will settle down by the final release of 1.0. One of the reasons that we use double quote syntax to initialize Characters is that they are expected to be able to hold full grapheme clusters, which are composed of multiple code points. This will roll out in a later beta.
-- Chris Lattner
Sources: https://devforums.apple.com/message/997759#997759 http://oleb.net/blog/2014/07/swift-strings/
What is happening here is that CGFloat is a typealias for either Float or Double depending on whether you're building for 32 or 64-bits. This is exactly how Objective-C works, but is problematic in Swift because Swift doesn't allow implicit conversions.
We're aware of this problem and consider it to be serious: we are evaluating several different solutions right now and will roll one out in a later beta. As you notice, you can cope with this today by casting to Double. This is inelegant but effective :-)
-- Chris Lattner
Sources: https://devforums.apple.com/message/998222#998222
Optional Bools in a boolean context are confusing.
var foo: Bool? = false
// This will print bar
if foo {
println("bar")
}
This problem exists with any optional of something that conforms to the LogicValue protocol (e.g. nested optionals, optional of bool, etc). We consider it serious issue that needs to be fixed for 1.0 and have some ideas, but haven't settled on a solution yet.
-- Chris Lattner
Sources: https://devforums.apple.com/thread/234399?tstart=0
We don't usually promise anything for the future, but in this case we are making an exception. Swift will have access control mechanisms.
-- Greg Parker
Access control (public/private/etc) is coming in a later beta, this is mentioned in the Xcode release notes.
-- Chris Lattner
Sources: https://devforums.apple.com/thread/228324?start=50&tstart=0 https://devforums.apple.com/message/996725#996725 https://devforums.apple.com/message/970220#970220
This is another obviously desirable feature, it is just a lot of work and didn't make it in 1.0 either.
-- Chris Lattner
Sources: https://devforums.apple.com/thread/228324?start=50&tstart=0
We're aware of the opportunity and also desire better error handling features in Swift, but they didn't make it in time for 1.0.
-- Chris Lattner
Sources: https://devforums.apple.com/thread/228324?start=50&tstart=0
This is something we're continuing to evaluate, expect @ signs to change in subsequent betas.
-- Chris Lattner
Sources: https://devforums.apple.com/thread/228324?start=25&tstart=0
This is a known problem, it will be fixed in later betas.
-- Chris Lattner
Soruces: https://devforums.apple.com/message/989902#989902
Unowned References Breaking in Beta 2
This should be fixed in Beta 3.
-- Chris Lattner