You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When writing iOS apps with watchOS target dependencies and also supporting macOS Catalyst, the target's platformFilter in the target dependencies is being ignored when reading and writing project.pbxproj file.
What 🌱
My app which has watchOS, iOS and macOS/Catalyst components has a target in which the iOS app is compiled. That target includes a dependency on the watchOS target as well. To resolve the fact that you can't embed a watchOS target in a Catalyst app, I select "iOS" from the Platforms dropdown in the Dependencies of the Build Phases tab. However, when reading/writing the project files using this xcodeproj library, this dropdown setting is forgotten.
Proposal 🎉
From 924fcef87cf4202786240f47b3fc6db20e82e840 Mon Sep 17 00:00:00 2001
From: Jeremy Buchman <[email protected]>
Date: Tue, 25 Feb 2020 16:03:51 -0700
Subject: [PATCH] Added platformFilter to target dependency for Xcode 11
support (WatchOS + Catalyst)
---
.../Objects/Targets/PBXTargetDependency.swift | 11 +++++++++++
.../Objects/Project/PBXProjIntegrationTests.swift | 3 +++
2 files changed, 14 insertions(+)
diff --git a/Sources/XcodeProj/Objects/Targets/PBXTargetDependency.swift b/Sources/XcodeProj/Objects/Targets/PBXTargetDependency.swift
index a21e721..817813e 100644
--- a/Sources/XcodeProj/Objects/Targets/PBXTargetDependency.swift
+++ b/Sources/XcodeProj/Objects/Targets/PBXTargetDependency.swift
@@ -7,6 +7,10 @@ public final class PBXTargetDependency: PBXObject {
/// Target name.
public var name: String?
+ /// Platform filter attribute.
+ /// Introduced in: Xcode 11
+ public var platformFilter: String?
+
/// Target reference.
var targetReference: PBXObjectReference?
@@ -72,6 +76,7 @@ public final class PBXTargetDependency: PBXObject {
case target
case targetProxy
case productRef
+ case platformFilter
}
public required init(from decoder: Decoder) throws {
@@ -79,6 +84,7 @@ public final class PBXTargetDependency: PBXObject {
let referenceRepository = decoder.context.objectReferenceRepository
let objects = decoder.context.objects
name = try container.decodeIfPresent(.name)
+ platformFilter = try container.decodeIfPresent(.platformFilter)
if let targetReference: String = try container.decodeIfPresent(.target) {
self.targetReference = referenceRepository.getOrCreate(reference: targetReference, objects: objects)
}
@@ -101,6 +107,11 @@ extension PBXTargetDependency: PlistSerializable {
if let name = name {
dictionary["name"] = .string(CommentedString(name))
}
+
+ if let platformFilter = platformFilter {
+ dictionary["platformFilter"] = .string(.init(platformFilter))
+ }
+
if let targetReference = targetReference {
let targetObject: PBXTarget? = targetReference.getObject()
dictionary["target"] = .string(CommentedString(targetReference.value, comment: targetObject?.name))
PS: I would have just submitted a pull request, but I couldn't resolve an issue with one of the tests and thus I couldn't get the project to compile without commenting out that test. (PBXProjIntegrationTests.swift)
The text was updated successfully, but these errors were encountered:
Context 🕵️♀️
When writing iOS apps with watchOS target dependencies and also supporting macOS Catalyst, the target's platformFilter in the target dependencies is being ignored when reading and writing project.pbxproj file.
What 🌱
My app which has watchOS, iOS and macOS/Catalyst components has a target in which the iOS app is compiled. That target includes a dependency on the watchOS target as well. To resolve the fact that you can't embed a watchOS target in a Catalyst app, I select "iOS" from the Platforms dropdown in the Dependencies of the Build Phases tab. However, when reading/writing the project files using this xcodeproj library, this dropdown setting is forgotten.
Proposal 🎉
PS: I would have just submitted a pull request, but I couldn't resolve an issue with one of the tests and thus I couldn't get the project to compile without commenting out that test. (PBXProjIntegrationTests.swift)
The text was updated successfully, but these errors were encountered: