What are the differences between Framework and Package in Swift? - ios

What are the differences between Framework and Package in Swift?
I knew about differences of swift embeddable components like,
Static Framework
Static Library
Dynamic Framework
Dynamic Library
But I do not know what is the purpose of the Swift Package?
When should I use Swift package?

In Swift, packages are reusable components of Swift, Objective-C, Objective-C++, C, or C++ code that developers can use in their projects. This is similar to packages in npm.
Packages are primarily distributed through Cocoa Pods, Swift Package Manager, and Carthage.
Packages can contain Frameworks and Libraries and can use other packages as dependencies.
You would use a package in Swift when you want to re-use a piece of code in different projects as you would an npm package in Javascript projects. An example would be NetworkUtils a package distributed on Cocoa Pods that provides networking support.
Packages are just a way to distribute code, like a framework or a library. The benefit comes from how easy it is to manage them. You can manage a list of the dependencies you want to include and the package manager will handle downloading and installing the code into your project for you. It also makes it easier to choose specific versions of packages to use in your project.
For example, if I want to include NetworkUtils in my project, I would just edit a Podfile (a Cocoa Pods file for managing dependencies) and would just add a line: pod 'NetworkUtils' and then run the pod install command in terminal and it would load the newest version of the package into my project.

Related

How can I use dart ffi properly in a pub package?

I am currently building a console package with Dart, and Rust using FFI(foreign function interface). Since I can't/shouldn't publish dll/so/dylib files, how can I add a build functionality to it. With that functionality, the required files should be built after the package is downloaded, so that the interop-ed code can work properly. How can it be done? Will the user that downloaded the package need to have Rust in his machine to build the files?
You need to either distribute binaries or require the user to have a Rust compiler.

Prohibit downloading Dependencies of CocoaPod

When I link a CocoaPod in a Podfile that includes further Cocopods via dependencies: How can I disable the installation of these dependencies (via the Podfile)?
Background scenario: GCDWebserver includes optional logging with CocoaLumberjack. CocoaLumberjack is nor required and only used if present in the project. Unfortunately the GCDWebserver 3.3 and newer links to CocoaLumberjack as dependency. But I don't want to include it because I'm using another logging framework.
Unfortunately the GCDWebserver 3.3 and newer links to CocoaLumberjack as dependency
This is not the case anymore since version 3.4.1 because it created problems like yours.

How can I use FsCheck with a portable class library?

How can I use FsCheck with a portable class library?
I receive the following error:
Error Could not install package 'FsCheck.Xunit 2.5.0'. You are trying
to install this package into a project that targets
'.NETPortable,Version=v4.5,Profile=Profile7', but the package does not
contain any assembly references or content files that are compatible
with that framework. For more information, contact the package author.
Does this mean FsCheck is not PCL compliant?

How should I distribute an OSX framework for use by developers of an application?

Let's say I'm building an application with a dependency on a third party library, but one I've built myself - say, Boost. I've packaged the dependency into a framework which is the OSX way of doing things.
How should I now distribute the framework to the developers of the dependent application? If this were Windows I'd probably use Nuget, or apt etc on Ubuntu. Python has pip for this kind of thing - is there a standard MacOS way of dealing with combined source & binary dependencies?
Cheers.
I can imagine 3 different ways to do this:
CocoaPods: This it the nearest thing to something like a "package manager" as you get.
Make a Github/Bitbucket Repository and use git for distribution
make a framework bundle and distribute it via download (e.g. zipped or packed in a .dmg) or email

xcode maven plugin install prebuilt

We are evaluating xcode-maven-plugin from http://sap-production.github.io/xcode-maven-plugin/site/ for handling iOS library dependencies using maven. It looks really promising but we are using some prebuilt third party libs we don't have the source code from that we would like to also install in maven and resolve as maven dependencies but we don't know how to achieve that with the plugin.
We have already used the maven-android-plugin for Android to upload third party binaries and we manage to do that playing with the headerFilesDirectives and nativeLibrariesOutputDirectory parameters but we haven't found anything similar for the xcode plugin.
Does anyone know if it is possible to install prebuilt iOS libraries with the latest(1.14.0) xcode-maven-plugin version?.
We are new to Maven so maybe we are missing something obvious here.
Why do not you use a CocoaPods instead? It's a dependency manager for Objective-C projects. It's like iOS equivalent of Maven.

Resources