tomlokhorst / XcodeEdit

Swift library for reading and writing Xcode project files in OpenStep format
MIT License
206 stars 38 forks source link

Latest release gives (fixable, but annoying) compiler errors #23

Closed felix91gr closed 7 years ago

felix91gr commented 7 years ago

Hi!

I'm talking about these errors:

/home/felix/Documents/SKD/SKD-Port/.build/checkouts/XcodeEdit.git-5429147157201105162/Sources/XCProjectFile.swift:40:38: error: 'JsonObject' (aka 'Dictionary<String, AnyObject>') is not convertible to 'AnyObject'; did you mean to use 'as!' to force downcast?
    return T(id: key, dict: obj.dict as AnyObject, allObjects: self)
                            ~~~~~~~~~^~~~~~~~~~~~
                                     as!
/home/felix/Documents/SKD/SKD-Port/.build/checkouts/XcodeEdit.git-5429147157201105162/Sources/XCProjectFile.swift:81:64: error: 'JsonObject' (aka 'Dictionary<String, AnyObject>') is not convertible to 'AnyObject'; did you mean to use 'as!' to force downcast?
    self.project = PBXProject(id: rootObjectId, dict: projDict as AnyObject, allObjects: allObjects)
                                                      ~~~~~~~~~^~~~~~~~~~~~
                                                               as!
/home/felix/Documents/SKD/SKD-Port/.build/checkouts/XcodeEdit.git-5429147157201105162/Sources/XCProjectFile.swift:102:43: error: 'JsonObject' (aka 'Dictionary<String, AnyObject>') is not convertible to 'AnyObject'; did you mean to use 'as!' to force downcast?
      return type.init(id: id, dict: dict as AnyObject, allObjects: allObjects)
                                     ~~~~~^~~~~~~~~~~~
                                          as!
/home/felix/Documents/SKD/SKD-Port/.build/checkouts/XcodeEdit.git-5429147157201105162/Sources/XCProjectFile.swift:107:41: error: 'JsonObject' (aka 'Dictionary<String, AnyObject>') is not convertible to 'AnyObject'; did you mean to use 'as!' to force downcast?
    return PBXObject(id: id, dict: dict as AnyObject, allObjects: allObjects)
                                   ~~~~~^~~~~~~~~~~~
                                        as!

In that release, those errors are fixed by changing as to as!. But I've also downloaded your develop branch and they are gone in your latest commit (I think you did the fixing at f5f8c0fd). I just want to ask, when is the next release coming? To prepare my Package.swift files accordingly :)

tomlokhorst commented 7 years ago

I've released version 1.1 with the current develop branch.

How are you getting these errors? I can't reproduce these. I'm using the Swift 3.0 and Swift 3.1 releases that ship with Xcode.

felix91gr commented 7 years ago

OMG, thank you so much! :)

How are you getting these errors? I can't reproduce these. I'm using the Swift 3.0 and Swift 3.1 releases that ship with Xcode.

Ah. It must be because I'm using a Swift 3.1.1 repo. If I remember correctly, there was some discussion in the mailing lists about AnyObject and how apparently it wasn't a good tool for the jobs it did. Therefore a recent PR (I think from Slava Pestov) changed how it was used. That must be it :thinking:

But actually, I'd be using the same binaries as you are if it weren't because I work on Linux. I need these recent commits (plus some cherrypicks that haven't been released in a tag yet) to have full Sourcekit support on Linux. I thought we were all having the same compiling errors until you said that you didn't :smile: