Code Monkey home page Code Monkey logo

Comments (8)

tadija avatar tadija commented on August 16, 2024

Hello @aaronpk,

I have looked into this problem, and I believe it's a possible bug on Apple side.

What I found out is that it's related to having custom subscript while inheriting from NSObject.

If you paste this code into Xcode Playground you'll see the same warning, but it will go away if you just remove inheritance from NSObject.

import Foundation

class ClassWithSubscript: NSObject {
    subscript(key: String) -> ClassWithSubscript {
        return self
    }
}

func testFunc(settings: Dictionary<String, AnyObject>) {
    if let nested = settings["foo"] {
        if let foo = nested["bar"] {
            print(foo as! Int)
        }
    }
}

What do you think? Should we report this as a bug?

from aexml.

JerrySievert avatar JerrySievert commented on August 16, 2024

i think it should be reported as a bug - the interesting thing is that it occurs in both 7.0 and 7.1 (swift 2 and 2.1).

from aexml.

gabek avatar gabek commented on August 16, 2024

Any updates on this? I run into this simply using subscript on a dictionary object, not even a custom class of mine.

from aexml.

friendlytoaster avatar friendlytoaster commented on August 16, 2024

I am having an issue with this as well. Has anybody found a suitable workaround?

from aexml.

tadija avatar tadija commented on August 16, 2024

Ok, so I just reported this bug to Apple. ID: 23694764

from aexml.

gabek avatar gabek commented on August 16, 2024

I'm just going through and changing all of my [subscript] syntaxes to .valueForKey to work around it.

from aexml.

iamdeepakmishra avatar iamdeepakmishra commented on August 16, 2024

Well i was also facing this issue, but then i was using Cocoapods.
Later i added the library manually and the issue was gone automatically.
I guess that something is wrong when we use it as a framework(please back me up if m right, otherwise enlightening is appreciated)

from aexml.

tadija avatar tadija commented on August 16, 2024

So, without some real solution from Apple (this bug is still open), I removed inheritance from NSObject which in fact fixed this warning, so this issue can be closed now. Thanks for dicsussion!

from aexml.

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.