Confusion due to Swift lacking implicit conversion of CGFloat

后端 未结 4 638
你的背包
你的背包 2020-12-16 02:10

Trying to do arithmetic in a function that returns `CGFloat, I get an error:

Couldn\'t find overload for \'/\' that accepts supplied arguments

4条回答
  •  星月不相逢
    2020-12-16 02:50

    In this specific case I have a cute trick to recommend

    let π = CGFloat(M_PI)

    Unicode everywhere, and π is easy to get to with Opt+P

提交回复
热议问题