https://kotlinlang.org logo
Title
n

Nikolay Kasyanov

09/01/2021, 9:36 AM
👋 it’s me again how does one use
XCFramework
extension function from
build.gradle
(no KTS)? Importing
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework
doesn’t work:
unable to resolve class org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework
Got it:
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFrameworkTaskKt

...
def xcFramework = XCFrameworkTaskKt.XCFramework(project, frameworkName)
Looks clumsy tho.
r

ribesg

09/01/2021, 9:51 AM
I mean who writes Groovy in 2021
n

Nikolay Kasyanov

09/01/2021, 9:52 AM
I’m too lazy to upgrade the whole project to kts honestly 😂
r

ribesg

09/01/2021, 9:52 AM
Can’t you import
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFrameworkTaskKt.XCFramework
?
n

Nikolay Kasyanov

09/01/2021, 9:57 AM
Unfortunately, no:
unable to resolve class org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFrameworkTaskKt.XCFramework
oh wait
import static
works, thanks @ribesg
👍 1
m

Mejdi

09/10/2021, 4:34 PM
Thank you, it was very helpful! just to clarify it here (as it took me sometime to get it 🙂 ) this how you import it in `build.gradle`:
import static org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFrameworkTaskKt.XCFramework
I hope this will help a newbie like me.
to mention, what Nikolay proposed works but not what exists in docs..it seems we need to update that. ( I am using Kotlin 1.5.30)
n

Nikolay Kasyanov

09/11/2021, 4:27 PM
@Mejdi thanks for sharing! Last time I checked
XCFrameworkConfig
wasn’t public though.
hmmm no it wasn’t, my bad
@Mejdi then I suggest to follow the docs
m

Mejdi

09/11/2021, 4:52 PM
I tried that, but it did not work for me. Yours did..
n

Nikolay Kasyanov

09/13/2021, 8:48 AM
@Mejdi I see, glad to have helped!
🙌 1