Ignore a warning in Swift Package manager - swift

I have a warning from an apparent needed dependency when trying to install the Amplify Swift Package:
Showing Recent Messages
ignoring declared target(s) 'swift-nio-zlib-support' in the system package
How can I ignore that warning? I tried this suggested solution but didn't clear it. I just want to suppress that one specifically without affecting any other.
Pd: I don't have any pods, I'm using swift package manager.
Thanks

Related

Swift Package Could Not be Resolved

I was adding the "Theo" package to my swift project and got the following error. Should I be concerned? I was allowed to add the package anyway, so I'm guessing that it wasn't a critical error?
EDIT:
The package is also greyed out, which seems problematic.

Swift Package and `#if canImport(...)`. How does it work?

Excuse the vague title.
I'm trying to build a package to help me use third-party cloud storage APIs (Firebase Storage for example), adding Combine support, etc. This package does the same thing with CloudKit. Everything compiles fine, but when I import the package module into a separate project of mine, the module is apparently missing some public symbols...
Specifically, the ones wrapped inside of an #if canImport(FirebaseStorage) condition. Since Firebase doesn't support SwiftPM yet, this part of the package behaves as expected in the package project itself; it simply skips compiling that whole bit. I figured that a client project that can import this module would compile it fine.
Aside: What I'm trying to do looks something like optional dependencies. I don't want to have to import Firebase to use this package's other features. I have considered splitting the package into separate sub-packages, each depending upon the particular third-party library I want to use. I might do that anyway. But the problem remains that Firebase doesn't yet support SwiftPM (although I hear they're close).
My issue appears similar to this one. My client project just doesn't seem to see the conditioned symbols, though it can import Firebase and FirebaseStorage just fine! I mean that the generated module header is missing them entirely, preventing my client project from compiling when I use them.
It seems to me that the compile condition never leaves the package's own scope of dependent targets. Is this the case? Or am I missing something obvious? I had always assumed that Swift Packages just import and compile the Swift source files into named modules, but now I think that is not so.
Is there a way to build code into a Swift Package that compiles only when the client can import a third-party module that does not yet support SwiftPM? Or does conditional compilation not work that way?
EDIT: Here is the Swift documentation on conditional compilation, for reference.
(Answer from experience in Apr 2020)
It looks like I'm just misunderstanding the compile order.
Importing my packaged module (let's call it CloudStorage) declares a dependency in the client project to that module. Before the client project can compile with its other dependencies, CloudStorage needs to compile without the main project's dependencies. Since CloudStorage doesn't know anything about those dependencies, canImport for those dependencies evaluates to false.
This may have changed in a later version of Swift. I've yet to try again.
canImport checks whether the module name provided can be imported. For swift packages, this evaluates to true if you have provided the module as a target dependency in the package manifest and all of its associated target dependency condition are satisfied.
The benefit of this is this allows you to write code in a platform agnostic way and let your package manifest take care of platform support.
Let's say I have Firebase as a dependency in my target:
.product(name: "Firebase", package: "firebase-ios-sdk", condition: .when(platforms: [.iOS, .macOS, .tvOS])),
I can write my code that depends on Firebase with canImport. Suppose in future firebase-sdk started supporting another platform, I can add the platform to my availability condition and start supporting that platform in my code as well.
But if you don't have the module listed as dependency, even if your client app can import the module, this condition will always evaluate to false. This is due to the sandbox nature of swift package build system and all your package targets are isolated so that consuming client's build settings doesn't affect your package target.

Library not Loading/Image not Found - Swift 4.0

So I am very new to Swift and XCode. I am trying to use an external library called JJFloatingActionButton the projects build fine but when I try run it on an emulator I get:
dyld: Library not loaded: #rpath/JJFloatingActionButton.framework/JJFloatingActionButton
Referenced from: /Users/mkangwa/Library/Developer/CoreSimulator/Devices/
3E58C8A1-3F02-4CA0-8EF3-A79311A202A2/data/Containers/Bundle/Application/D8BBF9A8-5BC7-4619-
B08C-2E6F7C6BCB85/DriversHub-iOS.app/DriversHub-iOS
Reason: image not found
Now of course I know you can't come ask a question like this on StackOverflow without researching and trying to find a solution yourself, so thats what I've been doing for the past few hours I have been looking at what was causing this, I started thinking that maybe it was the library it's self so this one is the third or fourth I've tried till I came across a few posts on SO that were about this issue.
Most people fixed this by just putting the Framework into the Embedded Binaries in the targets General Settings. And I tried this but I now receive a log:
I also get a Dependancy Analysis Warning:
I don't know much about these types or warning and errors but it's saying that it can't find the file which is pretty self explanatory but when I am adding the file to Embedded Binaries it shows the framework file there
What I often do when I have problems with cocoapods is remove cocoapods from the project and reinstall it.
You could use pod deintegrate (https://github.com/CocoaPods/cocoapods-deintegrate) to remove it and then a pod install to reinstall.
So it took a day and a half to work this out but I have finally got it and I can carry on with my project.
Problem:
The problem in my particular case (because other methods seemed to have worked for people trying to achieve the same thing) that the reason my project wouldn't build and was throwing Build Time errors was because after adding the Framework to Embedded Binaries it was also adding it to Embed Frameworks in my targets Build Phases. This then, I believe, caused the compiler to try and build it twice hence the Multiple Build Commands error
Solution:
So the errors I kept getting where saying No such file or directory above it was saying Multiple build commands for output file and what I did to fix this I went to Build Phases in my target settings and deleted the framework from Embedded Frameworks but made sure it was still under [CP] Embed Pods Frameworks.
in my case I was have to make framework "embed & sign" in stead of "don't embed"

CocoaPods framework with dependencies - include of non-modular header inside framework module

I am trying to build a private CocoaPods framework with other pod dependencies.
Among others, I added Parse as a dependency in the podspec file:
s.dependency 'Parse'
However, when I try to lint it,
pod lib lint MyPrivateSpec.podspec --verbose --sources 'git#bitbucket.org:MY_BITBUCKET_NAME/specs.git,https://github.com/CocoaPods/Specs'
I get the following errors:
Target Support Files/Parse/Parse-umbrella.h:3:9: note: in file included from Target Support Files/Parse/Parse-umbrella.h:3:
ERROR | xcodebuild: Parse/Parse/Parse.h:12:9: error: include of non-modular header inside framework module 'Parse.Parse'
[and more of these types of errors in the following lines ...]
I looked at virtually every relevant question asked on SO and in github issues, but I could not find anything that worked for me. Has anybody experienced these issues, or is familiar with why this does not work ?
This is unfortunately a problem with the Parse library itself. I ran into a similar situation a while back when I was trying to use the Parse library inside a framework I was building for iOS.
What the error means is that there is a header included in one of Parse's public .h files that does not belong to a module. In Parse's case this is <sqlite3.h> if I remember correctly. Without removing this from Parse's public headers it will not be possible to build a framework target that also includes Parse. This should be filed as a bug with Parse so they could work on an upgrade to support modular framework builds.
Due to the need for my project to build a framework target I had to pass on using Parse in my project as a result of the above.
Here is a reference to a similar problem with similar answer: https://stackoverflow.com/a/24728646/296708

Trying to upload a package through Package Manager

I'm trying to upload a package through the package manager but for some reason the a error is thrown that I couldn't find the reason why.
The only way that I found in order to solve the problem is to restart the server instance completely, removing the older packages as well.
Best Regards
Looks like multiple bundles providing the javax.xml.parsers.DocumentBuildFactory interface, I would check which of the currently active bundles export this package to eliminate duplicates.