Convert SPM modules to .xcframework - swift5

My iOS project is split up in several SPM modules. Now I would like to distribute some of them as .xcframework.
Is there a way to automatically create .xcframeworks out of the SPM modules? Or some (fastlane?) script I could use to create them?

Related

Is it possible to import and add .xcframework file to a static xcode library project?

I have set of .xcframework files, and currently I working on a static library
I need to integrate those .xcframework files into my static library, but it seems Build settings menu and build phase menu on a static library project is different and I can't add .xcframwork files like I used to do on a Xcode app project
You add dependencies under Build Phases tab, in Link Binary With Libraries step:
Be advised that in this scenario you cannot embed any framework. It either has to be delivered alongside the library or adding the dependencies has to be part of the library integration instructions. I.e. the consumers of your library will need to add this xcframework dependency manually in their target.

Xcode does not generate DYSM for SPM dependencies

Xcode is not generating dSYM files for my three SPM dependencies.
I have tried creating a new Swift only project and including a SPM package like CocoaLumberJack and even there I am not given a dSYM for release.
I am using Xcode 12.0.1, I have looked through all kinds of build settings with no luck to force them to be generated or find where Xcode puts them if it is generating them.
Swift packages by default are treated as static library, that is why you don't see the embed options for them in Frameworks, Libraries, and Embedded Content section:
Static libraries don't require separate dSYM files are they don't have any executable. They are directly contained in consuming app executable so the static library symbols will be available in application's dSYM file. If you inspect you app's ipa you won't find the swift package module in Frameworks directory.
You can also make your swift package exposed product dynamic library by specifying library type as .dynamic:
.library(
name: "SwiftLibrary",
type: .dynamic,
targets: ["SwiftLibrary"]
),
This will make your package module dynamic library and will allow you to choose embed option in XCode:
If you make your package module dynamic and you can inspect your ipa to see this embedded in the Frameworks folder. After making your package module dynamic you separate dSYM file will be generated for it.

How can I use folders in a Swift application compiled from the command line?

I'm building a simple webserver using Swift3 and the Swift Package Manager. Running swift build in your project folder will build all of the sources found in the Sources directory and output an executable. However, I've found that if I create folders within the Sources directory to organize my code, my builds fail. It looks to me like the presence of folders causes swift to treat the source as different modules. Is this the cause, and if so, how can I work around it?
Yes. Putting directories directly under Sources will cause SwiftPM to interpret those as modules. This is described in the package manager reference.
To work around this, use another level of indirection: put a directory for your module inside Sources and your additional directories inside that directory:
Sources/YourApp/Stuff/Source1.swift
Sources/YourApp/Stuff/Source2.swift
Sources/YourApp/MoreStuff/Source3.swift
Sources/YourApp/MoreStuff/Source4.swift

How to best use NuGet for source file deployment

I would like to use NuGet packages for building packages for core helper libraries which I would like to add as source files into other projects. I want to use source files instead of libraries for several reasons, the main one being that I need them in SharePoint Projects, which is on the one hand much easier to deploy than additional libraries, and on the other hand helps to reduce version conflicts.
I know that I can add the source files as content to NuGet Packages, which would install them with the package. But this won't work together with package restore, and I don't want to have these files checked into source control in all projects.
Is it somehow possible to make a NuGet package which doesn't copy the files to the project, but instead adds file links, which point back to the file in the package folder, to the project? I think this approach would solve my use case.
Thanks
pascal
It is possible to add linked files with the use of PowerShell scripts, for example with this NuGet script: http://www.nuget.org/packages/Baseclass.Contrib.Nuget.Linked/

Does a static library add inside another static library? iOS/Xcode

I'm creatic a static library to distribute to other projects (they don't see the library source code), and I wonder some questions:
-I follow this guide:
http://developer.apple.com/library/ios/#technotes/iOSStaticLibraries/Articles/creating.html
I create a .a file, several .h files and another .bundle file. The question is that my project library uses includes ResstKit (and uses it). In the product directory I see my library .a and the RestKit .a file. Do I have to distribute that restkit .a file? or is it already included inside my own .a file?
-The Apple guide doesn't say anything about fat or universal libraries. How can I create my library for the device and simulator at the same time? I see some scripts on the net, but I guess there must be some option there. What do you think? (BTW, do fat and universal have the same meaning?)
-Is there anyway to tell the target zip everything or create a DMG package? I guess using a Python script is possible, but I mean using any Xcode option.
Thanks in advance.