-
-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support SPM generated projects #124
Conversation
Sources/xcproj/XCWorkspace.swift
Outdated
@@ -34,6 +34,12 @@ public class XCWorkspace { | |||
self.data = data | |||
} | |||
|
|||
/// Returns an empty workspace. | |||
public static var `empty`: XCWorkspace { | |||
let data = XCWorkspace.Data(references: []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to omit XCWorkspace.
and use only Data(references: [])
?
return fixturesPath() + "iOS/Project.xcodeproj" | ||
|
||
func test_init_usesAnEmptyWorkspace_whenItsMissing() { | ||
let got = projectWithoutWorkspace() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you use this name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a project that doesn't have a workspace internally. Would you use a different name @artemnovichkov?
Sources/xcproj/XCWorkspace.swift
Outdated
@@ -34,6 +34,12 @@ public class XCWorkspace { | |||
self.data = data | |||
} | |||
|
|||
/// Returns an empty workspace. | |||
public static var `default`: XCWorkspace { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it seem as if it's a singleton. You could remove this and just make a new initializer that doesn't take data
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, makes more sense. Let me update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done @yonaskolb
…ace when it's missing
…implementation to return one file reference, self:
fbdbc82
to
e33b9e9
Compare
Resolves #119
Short description 📝
As @josefdolezal described in the issue above, projects generated by the Swift Package Manager cannot be opened with xcproj because the project.workspace property is non-optional. The purpose of this PR is to provide support for those.
Solution 📦
Since property is public, any change in the property would introduce a breaking change in the API. What I did instead is initializing a workspace with one file reference,
self:
in the same way Xcode does.Implementation 👩💻👨💻
XcodeProject
model.GIF