https://kotlinlang.org logo
#ios
Title
# ios
n

nhaarman

08/26/2021, 9:13 AM
What tactic should I use for the following scenario? • I have an existing XCode project that uses XCodegen and a Podfile • I created a KMM project with logic I want to share between JVM and iOS What steps should I take to use my logic in my XCode project? Should I create fat frameworks? An XCFramework? Something else?
l

louiscad

08/26/2021, 10:28 AM
XCFramework, ideally.
n

nhaarman

08/26/2021, 11:04 AM
Ah then I was on the right track. What would be the best way to reference it in xcode? Do I need to create a podspec file?
l

louiscad

08/26/2021, 11:13 AM
Nope you don't. Just import it like any other XCFramework. If you don't find where, I think a Google search will quickly give the right hints.
n

nhaarman

08/26/2021, 11:29 AM
Ah yes, it works when adding it to a target's frameworks and libraries, but that of course gets reset when I run pod install 🤔
Is there a way for Podfile to include an XCFramework without having to create a podspec file?
l

louiscad

08/26/2021, 12:56 PM
I'd search for the issues you have on Google, you're probably not the first who gets stuff reset by Cocoapods.
s

Sam

08/26/2021, 1:54 PM
If you’re adding the xcframework to your app’s project and not the cocoapods project, it shouldn’t be getting reset.
n

nhaarman

08/26/2021, 2:02 PM
Hm perhaps I'm confusing some things. If I add my XCFramework to a target's frameworks and libraries and run
xcodegen generate
, then the XCFramework is removed again right?
n

Nico Richard

10/29/2021, 1:24 PM
@nhaarman I randomly found this searching around for a different issue, but if you’re using xcodegen you need to define the dependency in the project spec: https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#dependency
10 Views