Coder Social home page Coder Social logo

Comments (2)

 avatar commented on August 15, 2024

This seems to be a 64 bit v 32 bit issue.

CGFloat is typealiased to Float. However, Float is always 32 bits, whereas CGFloat is meant to be 64 bits on 64 bit hardware.

We may need to use CGFloat until Apple figures out just how broken their code is.

--------- Original Message --------- Subject: [SKTUtils] The Swift version of SKTUtils gives many compilation errors on OS X (#1)
From: "Matthijs Hollemans" [email protected]
Date: 6/13/14 6:14 am
To: "raywenderlich/SKTUtils" [email protected]

For some reason, the compiler on OS X is more strict about its types. On iOS this works fine:
extension CGPoint {
init(angle: Float) {
return self.init(x: cosf(angle), y: sinf(angle))
}

But on OS X it needs to be written as:
extension CGPoint {
init(angle: Float) {
return self.init(x: CGFloat(cosf(CFloat(angle))), y: CGFloat(sinf(CFloat(angle))))
}

Maybe this is a different build setting, maybe it's a compiler feature/bug. Let's wait until we get a new beta.
Maybe we should also use CGFloat in the API instead of Swift's own Float.

Reply to this email directly or view it on GitHub.

from sktutils.

hollance avatar hollance commented on August 15, 2024

Resolved by renaming all uses of Float to CGFloat.

from sktutils.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.