Giter Club home page Giter Club logo

Comments (2)

Ocupe avatar Ocupe commented on June 11, 2024 1

Thank you for the inside @dgelessus. I tried len() and it worked but I didn't know if it was an accident or if it was designed to work. Now I know! I used it to fix beeware/toga#171.

from rubicon-objc.

dgelessus avatar dgelessus commented on June 11, 2024

You are right, there were some changes to how properties work (see #41), which means that if you want to use a property directly (without calling it like a method), you need to declare it first using ObjCClass.declare_property.

However that's not the reason why you're getting this error, and declare_property won't help here. count is always a method because of #42, which added special cases to make NSArray and NSDictionary work like Python list and dict. We had a small name conflict there, because there is a count method on Python list and Objective-C NSArray, but the two do different things. In the end, we decided to make count on NSArrays work like Python list.count. That means to get the length of a NSArray, you need to use len like with a Python list, instead of the count method.

from rubicon-objc.

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.