Code Monkey home page Code Monkey logo

Comments (6)

nuclearace avatar nuclearace commented on May 23, 2024

I'm confused, the library itself is causing this generic problem with NSArray?

Your test code is rather silly, that loop would never execute. Can you provide an example of how you're using it with the library.

Also look into upgrading to Xcode 6.3/Swift 1.2. Because I'm not going to be applying fixes to pre-2.0

from socket.io-client-swift.

pmanijak avatar pmanijak commented on May 23, 2024

Your questions are reasonable. I admit this issue does appear ridiculous upon first glance. Please allow me to elaborate:

  1. Yes, the library itself is causing the problem. Removing the import statement causes the build to succeed.
  2. Yes, the test code is silly, and the loop would never execute. Here is the point: The only interaction this code has with the library is that this code is in the same project as the "import Socket_IO_Client_Swift" statement. This code could be in a different file, and the compile error still occurs.

However, to satisfy your question: Imagine I have a json object represented somewhere in my Swift code. That json could be something like this:

{
    "things": [{
        "foo": 1
    },{
        "foo": 2
    }]
}

In Swift I could then do something like:

if let json = NSJSONSerialization.JSONObjectWithData(...) as? NSDictionary {
  if let array = json["things"] as? NSArray {
    for thing in array {
      let foo = thing["foo"]
      // Do something with foo
    }
  }
}

I also agree that Swift 1.2 is the future. Perhaps we've discovered an issue with the Apple compiler.

from socket.io-client-swift.

nuclearace avatar nuclearace commented on May 23, 2024

That's really strange, I don't think I'm doing anything that should interfere with NSArray or NSDictionary

from socket.io-client-swift.

pmanijak avatar pmanijak commented on May 23, 2024

I'm downloading Xcode 6.3 now to test it with that. I'll continue investigating.

from socket.io-client-swift.

pmanijak avatar pmanijak commented on May 23, 2024

This works fine with Xcode 6.3 and version 2.0.2 of this library.

from socket.io-client-swift.

nuclearace avatar nuclearace commented on May 23, 2024

That's strange, well if it works I'll close the issue

from socket.io-client-swift.

Related Issues (20)

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.