The compactMap() method, when used on a sequence of optional values, produces a non-optional sequence where all the optional values are unwrapped and the nil values are discarded. We now use
compactMap() in the conversion results to unwrap array or dictionary of optional values. Try it!
Swiftify now also uses
guard let to cast the
for iterator variable to the destination type, making the converted code safer. Try it!
When evaluating a ternary operator, in case the expression results to a nil value then the converter tries to set a default value whenever possible. Try it!
These changes make the converted code safer. You can check the difference in the conversion results by toggling the conversion result for Swift 4.2 and Swift 5.0 on the converter website.