You will love today's update!
1. Variables of primitive types are unwrapped early to avoid optionals
Variables of primitive types like Int are now unwrapped immediately when declared.
Consider the following sample (from Apple's Sketch sample project):
Previous output:
Current output:
As you see, the graphicsCount variable is now unwrapped early, so no need to unwrap it later in the code.
Try it online and switch between Swift 5.0 and 5.1 to see the difference!
2. Variables of string and collection types are initialized with nil
Previously, strings and collections were initialized with empty literals (when an initializer is required in Swift, but missing in Objective-C).
Now we are using nil initializers by default, for better compatibility with Objective-C code.
Try it online and switch between Swift 5.0 and 5.1 to see the difference!
3. Pointers to primitive types are no longer converted to arrays
Previously, variables declared as pointers to primitive types (like Int*) were converted to Swift arrays.
Now, these declarations are converted to UnsafePointer variables, which exactly matches the way how such declarations are imported by Xcode.
Comments
0 comments
Please sign in to leave a comment.