Why: calling SwiftUI.Color(red:green:blue:alpha:) compiler can infer param type is Double, but calling with .init(red:green:blue:alpha) it cannot and must use explicit Double literal

no, SR-15221 is very different and more convoluted.

shorter form:

import SwiftUI
    
struct SomeView: View {
	let width: CGFloat = 0

	func foo(_ v: Double) -> some View {
		EmptyView()
	}

	// not ok
	var body: some View {
		foo(2 * width / 3)   // Error: Ambiguous use of operator '/'
	}

	// ok
//    var body: some View {
//        foo(2 * width / 3) // yet this is ok
//        return EmptyView()
//    }
}
1 Like