Is it possible to create single ios framework that...
# kotlin-native
s
Is it possible to create single ios framework that contains X64, Arm32 and Arm64 in single framework package.. The below gradle code produces 3 separate frameworks.
l
Did you mean Unibersal Binary (https://www.wikiwand.com/en/Universal_binary)? I’m curious on this too!
👍 1
s
Yes. Universal binary, that’s the word am searching for 🙂 Currently I am importing all 3 as separate Embedded binaries to the app. If there is a way to generate universal binary. it will be great
j
search for
lipo
command
and in one of many kotlin/native or mpp examples tere is a gradle function that uses lipo to make one fat binary
it will look like this:
Copy code
def workDir = "$buildDir/lib/main/${buildType.toLowerCase()}"
// Get filenames we'll need next
        def targets = ['ios_arm64', 'ios_x64']
        def frameworks = files(targets.collect { target ->
            "$workDir/$target/${libraryName}.framework/$libraryName"
        })
// Merge two executables into fat lib
        def output = file("$outputDir/${libraryName}.framework/$libraryName")
        exec {
            executable = 'lipo'
            args = frameworks.files
            args += ['-create', '-output', output]
        }
👍 2
s
Thanks @Jaroslav. Will give it a try 🙂
s
When you go to submit to the App Store I believe you’ll need to strip out the x64 symbols or you’ll get an upload error.
👍 2
s
Thanks for the info @Sam