Mathematical functions in Swift

后端 未结 6 2298
花落未央
花落未央 2020-11-30 23:04

How do I use mathematical functions like sqrt(), floor(), round(), sin(), etc?


When doing:

         


        
6条回答
  •  离开以前
    2020-11-30 23:53

    To be perfectly precise, Darwin is enough. No need to import the whole Cocoa framework.

    import Darwin
    

    Of course, if you need elements from Cocoa or Foundation or other higher level frameworks, you can import them instead

提交回复
热议问题