SE-0307 introduced a small but important quality of life improvement: Swift is able to implicitly convert between
Double in most places where it is needed.
In its simplest form, this means we can add a
CGFloat and a
Double together to produce a new
Double, like this:
import Foundation let first: CGFloat = 42 let second: Double = 19 let result = first + second print(result)
Swift implements this by inserting an implicit initializer as needed, and it will always prefer
Double if it’s possible. More importantly, none of this is achieved by rewriting existing APIs: technically things like
scaleEffect() in SwiftUI still work with
CGFloat, but Swift quietly bridges this to
SPONSORED Spend less time managing in-app purchase infrastructure so you can focus on building your app. RevenueCat gives everything you need to easily implement, manage, and analyze in-app purchases and subscriptions without managing servers or writing backend code.
Link copied to your pasteboard.