Hi. I'm just trying to get some basic examples going, but no luck so far. The only function example I can find, func logit<NumberType: Real>(_ p: NumberType) -> NumberType { log(p) - log(onePlus: -p) } print(logit(12.456)) gets me a Cannot convert return expression of type 'Float' to return type 'NumberType' message from Xcode 12 beta on macOS 10.15.5. (It gives various suggestions, all of which don't help or lead me in the right direction.) This other attempt seems (* to me) like it should work: func testPow<T: Real>(_ x: T, toThe y: T) -> T { pow(x, y) } print(testPow(10.0, toThe: 12.3456)) but I get Type of expression is ambiguous without more context. I can't image what the missing contextual info might be here. (Both examples import both Foundation and Numerics.) Thanks for any help! Jeff
Search results for
[tags:wwdc20-10041]
1 result found
Selecting any option will automatically load the page