diff --git a/PrivacyInfo.xcprivacy b/PrivacyInfo.xcprivacy new file mode 100644 index 0000000..6af1641 --- /dev/null +++ b/PrivacyInfo.xcprivacy @@ -0,0 +1,14 @@ + + + + + NSPrivacyTracking + + NSPrivacyCollectedDataTypes + + NSPrivacyTrackingDomains + + NSPrivacyAccessedAPITypes + + + diff --git a/build.gradle.kts b/build.gradle.kts index 84cda8f..edc538a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -198,3 +198,25 @@ kmmbridge { } addGithubPackagesRepository() + +/** + * Apple requires 3rd party frameworks to include a privacy policy file. + * + * Based on a discussion on the Kotlin Slack, several people proposed the below solution to copy the privacy policy + * file to the framework output directory. + * + * Source: https://kotlinlang.slack.com/archives/C3PQML5NU/p1711715546770359 + */ +rootProject.afterEvaluate { + tasks.withType().forEach { linkTask -> + val frameworkDestinationDir = linkTask.outputFile + linkTask.doLast { + rootProject.copy { + val privacyFile = rootProject.file("PrivacyInfo.xcprivacy") + + from(privacyFile) + into(frameworkDestinationDir.get()) + } + } + } +}