-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
Remote project support for PBXContainerItemProxy #425
Remote project support for PBXContainerItemProxy #425
Conversation
…ainer-portal-as-file-reference
var containerPortalReference: PBXObjectReference | ||
|
||
/// Returns the project that contains the remote object. | ||
/// Returns the project that contains the remote object. If container portal is a remote project this getter will fail. Use isContainerPortalFileReference to check if you can use the getter |
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.
Considering that we are in the middle of a major release, I'd take the opportunity to make the API nicer. What about something like:
enum ContainerPortal {
case project(PBXProject)
case fileReference(PBXFileReference)
}
// PBXContainerItemProxy
class PBXContainerItemProxy {
public var containerPortal: ContainerPortal
}
What do you think @damirdavletov ?
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.
@pepibumur I agree regarding making the API nicer. My objective was not introduce breaking changes, but if that's not problem I'll try to make it nicer. Thanks for the feedback!
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, we avoid introducing breaking changes but this is a special case because we are working on a major release. Feel free to leverage Swift features to make the API nice :)
return remoteGlobalIDReference?.value | ||
} | ||
set { | ||
remoteGlobalIDReference = newValue.map { PBXObjectReference($0) } |
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.
I might be wrong because it's been a long time without playing with this project but I'd say the remoteGlobalIDReference
is not necessary. We can just have removeGlobalID
of type String.
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 is a great idea @damirdavletov. Thanks for bringing this to the project 👏
Codecov Report
@@ Coverage Diff @@
## master #425 +/- ##
==========================================
- Coverage 79.01% 78.88% -0.13%
==========================================
Files 141 141
Lines 6842 6862 +20
==========================================
+ Hits 5406 5413 +7
- Misses 1436 1449 +13
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #425 +/- ##
==========================================
+ Coverage 79.01% 79.07% +0.06%
==========================================
Files 141 141
Lines 6842 6859 +17
==========================================
+ Hits 5406 5424 +18
+ Misses 1436 1435 -1
Continue to review full report at Codecov.
|
@pepibumur Thanks for the improvement suggestions! Please have a look at the amended implementation as per your comments. |
@@ -1,5 +1,11 @@ | |||
import Foundation | |||
|
|||
public enum ContainerPortal { |
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.
I'd move this one into PBXContainerItemProxy
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.
@pepibumur this is done
Only one more thing @damirdavletov, could you update the CHANGELOG? Make sure that entry that you add states that the change is a breaking change. |
Codecov Report
@@ Coverage Diff @@
## master #425 +/- ##
==========================================
+ Coverage 79.01% 79.07% +0.06%
==========================================
Files 141 141
Lines 6842 6859 +17
==========================================
+ Hits 5406 5424 +18
+ Misses 1436 1435 -1
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #425 +/- ##
==========================================
+ Coverage 79.01% 79.07% +0.06%
==========================================
Files 141 141
Lines 6842 6859 +17
==========================================
+ Hits 5406 5424 +18
+ Misses 1436 1435 -1
Continue to review full report at Codecov.
|
This was already there. Let me know if you need anything else done. Thanks! |
I think this may have broken things. Code outside this project can't get access to the |
In addition as the enum RemoteGlobalID {
case object(PBXObject)
case uuid(String)
} |
Would you mind opening an issue with that @yonaskolb? |
Short description 📝
PBXContainerItemProxy can reference objects defined either within the same .xcodeproj or within a remote one.
If the object is within the same .xcodeproj as the proxy then containerPortal property contains PBXProject object and remoteGlobalIDString contains the ID of the object which can be accessed through the normal object pool.
On the other hand if the referenced object is in remote .xcodeproj then containerPortal property contains PBXFileReference of remote .xcodeproj (where the object is located) and remoteGlobalIDString contains the ID of the object which cannot be accessed through the normal object pool so has to accessed as a string.
Currently support for remote project is absent so I'm adding it in this pull request.
Solution 📦
I added containerPortalAsFileReference and remoteGlobalIDString properties to be able to access the values.
Also isContainerPortalFileReference is introduced in order to check if containerPortal is a file reference or not.
Additionally I split the init method onto 2 convenience initialisers, one for local proxy and one for remote.