Swift 6.1的beta3发布了。关于Swift的改动如下:
!
• A large number of AppKit APIs have been audited for optional conformance in addition to
WebKit, Foundation, UIKit, CoreData, SceneKit, SpriteKit, Metal APIs. As a result, a significant
number of implicitly unwrapped optionals have been removed from their interfaces. This
clarifies the nullability of their properties and arguments / return values of their methods. This is
an ongoing effort.! !
These changes replace T! with either T? or T depending on whether the value can be null or not
respectively. If you find a case that is incorrect, log a bug at
http://bugreport.apple.com and
include the tag “#IUO” in the subject line.! !
If you encounter a method, property or initializer for which the return value is incorrectly
considered non-nullable, you can work around the problem by immediately wrapping the result
in an optional:! !
var fooOpt: NSFoo? = object.reallyMightReturnNil()!
if let foo = fooOpt { … }! !
Be sure to log a bug about these cases. Do not file feature requests about APIs that are still
marked as T!, we know about them.! !
• Values of type Any can now contain values of function type. (16406907)! !
• Documentation for the standard library, which shows up in quick help and in the synthesized
header for the Swift module, is improved. (16462500)! !
• All of the *LiteralConvertible protocols now use initializers for their requirements rather
than static methods starting with convertFrom. For example, IntegerLiteralConvertible
now as the following initializer requirement:! !
init(integerLiteral value: IntegerLiteralType) !
Any type that previously conformed to one of these protocols will need to replace its
convertFromXXX static methods with the corresponding initializer. (18154091)! !
• Xcode now produces fixit hints to move code from the old-style fromRaw()/toRaw() enum
APIs to the new style-initializer and rawValue property.! !
• Class properties don*t need to be marked final to avoid O(n) mutations on value semantic
types. (17416120)!