I have a KMP project that has the following target...
# multiplatform
s
I have a KMP project that has the following targets:
androidMain
,
iosMain
and
tvosMain
. I am adding my iOS/tvOS dependencies using Cocoapods. It works fine until I have a dependency that supports only one apple platform and not the other. My
build.gradle.kts
looks like this:
Copy code
cocoapods {
	version = "1.0"
	ios.deploymentTarget = "15.0"
	tvos.deploymentTarget = "15.0"

	framework {
	    baseName = "PodsFramework"
	}

	pod(name = "Framework1")
	// iOS only
	pod(name = "iOS-Framework2")
	// tvOS only
	pod(name = "tvOS-Framework3")

}
Is it possible to add a "pod" only for iOS and not for tvOS? I expect the generated podspec to be:
Copy code
spec.dependency = "Framework1"
spec.ios.dependency = "iOS-Framework2"
spec.tvos.dependency = "tvOS-Framework3"
The error that I am getting is:
Task :shared:podInstallSyntheticTvos FAILED
Is it possible to add platform specific dependencies like this?
f
you should have more information of the error, it’s not only one line
s
The error itself makes sense, because it's trying do pull down an iOS specific dependency in a project that supports tvOS as well, and that's why I didn't post it. The question was more towards how to do platform specific dependencies in build.gradle.kts. Btw, here's the error:
Copy code
Executing of '/opt/homebrew/bin/pod install' failed with code 1 and message: 

Analyzing dependencies
[!] The platform of the target `tvos` (tvOS 15.0) is not compatible with `iOS-Framework3 (5.0.0)`, which does not support `tvOS`.
f
You set 2 pods specific at iOS and tvOS each, it can’t work
so the error is logical
so you need to create a kmp module dedicated at tvOS and one dedicated at iOS (and sharing some code as possible)
it’s the same thing if it was used from xCode
s
I see. I was hoping to do something like
Copy code
cocoapods {
    ...
	pod(name = "Framework1")
	// iOS only
	pod(name = "iOS-Framework2")
	// tvOS only
	pod(name = "tvOS-Framework3")

}
I see, thanks for your response