tomlokhorst / XcodeEdit

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

Adding a URL and name to XCProjectFile for use by `xcodebuild`. Significant Refactor. #9

Closed ky1ejs closed 6 years ago

ky1ejs commented 8 years ago

I've been using Xcode.swift in a command line application we've been making. We're using it to pass project, scheme and target data to xcodebuild.

It would be really handy if XCProjectFile stored the name and URL of the Xcode project it pointed to so that it could be retrieved later (we'd pass it to xcodebuild).

I've already tried making this refactor, but I'm finding it quite complicated to do because of the way the code is architected. For example, if a url: NSURL property were to be added to the XCProjectFile class then all the initialisers would have to take an NSURL parameter. When I considered this it came to me that the initialisers in XCProjectFile class that don't take an NSURL, actually belong in the PBXProject class as they actually provide initialisation for the PBXProject class, not the XCProjectFile.

I'd like to suggest quite a significant refactor to Xcode.swift to simplify future kinds of refactors like this, and improve encapsulation. I'm very conscious that this might not be something you're interested in doing because of the amount of work it presents :sweat_smile:, but I think it would greatly improve Xcode.swift, and make it easier for other contributors in the future. And of course I'd be more than happy to help! :smile:

I think this is a great project, and I'd much rather contribute to your work so far rather than create a duplicate :smile:. I've committed my attempt so far at adding a project name to XCProjectFile here to give an idea of the challenges. It'd be great to discuss different approaches to Xcode.swift's architecture.

Let me know what you think! :)

tomlokhorst commented 8 years ago

Hey, just wanted to let you know I did see this issue, as well as the pull requests you've opened. Thanks for these!

I'm a bit busy at the moment, so I haven't had time to look at these in detail. I hope to do that later next week.

Also, in case you hadn't seen it, I'm working on a serialization feature (https://github.com/tomlokhorst/Xcode.swift/pull/4) that itself is also a major refactor of the codebase. This feature is needed for a future version of R.swift, so I do plan on completing it.

ky1ejs commented 8 years ago

Awwwesssommmeee!! Can I help in anyway with your refactor? Are there any tasks on the list you've made that I could take care of for you?