swift-package-manager | Example project for the Swift Package Manager tutorial | Learning library
kandi X-RAY | swift-package-manager Summary
kandi X-RAY | swift-package-manager Summary
Example project for the Swift Package Manager tutorial article.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of swift-package-manager
swift-package-manager Key Features
swift-package-manager Examples and Code Snippets
Community Discussions
Trending Discussions on swift-package-manager
QUESTION
I'm trying to migrate a CocoaPod to SPM. It should be very simple, but for some reason I keep getting the error "Failed to parse manifest file".
The repo with the library an be found here: https://github.com/agcoesbenr/RBSManager/tree/swift-package-manager
...ANSWER
Answered 2021-Nov-19 at 10:23I don't know from where you got only your error message, but it's incomplete. In Terminal.app, if you do $> swift build
, you'll get this error:
QUESTION
I'm trying to get dependency target based in SPM, I have Package.swift
defined here:
So I have RxSwift
defined in package dependencies but it's NOT used in target ReCaptcha
but only in target ReCaptchaRx
If I choose to select only one target without Rx
I expected it to fetch only ReCaptcha
dependency and ignore Rx
.
After importing only ReCaptcha
I'm getting package resolved but unusable, if I choose on import window ReCaptchaRx
I'm getting as expected usable Rx what is fine. But why then SPM even fetching and resolving RxSwift
in this case?
Why Xcode is resolving RxSwift
on target that does not have a dependency to it? Can that be prevented? I would expect similar behaviour as with AppSwizzle
in this example that if target is not used is not being resolved.
This is an open source library available here: https://github.com/JakubMazur/ReCaptcha/blob/swift-package-manager/Package.swift
If you want to checkout this in SPM will resolve package from https://github.com/JakubMazur/ReCaptcha
on branch swift-package-manager
ANSWER
Answered 2021-Jul-16 at 13:40Basically, Swift Package Manager is not yet sophisticated enough to not resolve all transitive dependencies, even if they are exclusively used by a target you are not depending on.
While it is clutter that all transitive dependencies show in the Xcode sidebar package dependencies list, I do not believe it implies that your Demo app would actually ship with any of those unused targets/dependencies. It is only clutter in the sense that they show in that sidebar and that they are checked out in cache directories.
Slightly different: as of SPM 5.2, SPM is smart enough to not download transitive dependencies only used by your dependencies' test targets. Perhaps one day this will be improved to cover the case you ask about as well.
QUESTION
I'm trying to add SPM support for my library. I need to define unsafeFlags
for one of my library's targets (In order to import Swift code into Objective-C++):
ANSWER
Answered 2021-Jun-09 at 00:06.unsafeFlags
are not allowed for dependencies specified with a version. The workaround is to specify the version with a commit hash.
Detailed discussion and another workaround for monorepos at https://forums.swift.org/t/override-for-unsafeflags-in-swift-package-manager/45273
QUESTION
After I read the instructions listed here for how to add Firebase
as a dependency to a Swift package, I couldn't get it to work, here's my Package.swift
manifest:
ANSWER
Answered 2021-May-30 at 08:16I figured out the solution, but unfortunately it's not documented on Firebase Docs, I have to add the .platforms
array in the Package.swift
manifest specifying a version that supports FirebaseRemoteConfig, for example:
QUESTION
Swift Package Manager
can be a convenient way to build swift projects, and, if you (remove the absolute toolchain @rpath it adds to your binary), you can even distribute its builds.
But SPM doesn't seem to produce .dSYM
debug symbol packages, so how can you symbolicate the crash reports?
Is there a better way than using swift package generate-xcodeproj
and then getting Xcode to create the build and dSYM
s, effectively reducing SPM to .xcodeproj
shorthand?
ANSWER
Answered 2021-May-07 at 21:46UPDATE
swift build -c release
seems to create a dSYM
package by default. But if you suddenly decided you wanted your debug build to have dSYM
s too, then read on.
You can get dSYM
output from SPM's swift build
, by passing -g
and -debug-info-format=dwarf
to swiftc
. To do this from swift build
the arguments must each be escaped with -Xswiftc
:
QUESTION
I am trying to put a CoreData model into a Swift Package to extract my model code / classes from my main codebase.
I have done the following to recreate the issue I'm having from scratch:
- Create a new swift package called SampleModelPackage (File -> New -> Swift Package)
- Created a Core Data Model Definition File (Create File -> New -> File | iOS -> Core Data -> Data Model)
- Saved it in the Sources/SampleModelPackage directory alongside the auto-generated SampleModelPackage.swift
Now - when I attempt to open the Model.xcdatamodelId file in Xcode, it just shows me a "Version" icon (see screenshot), whereas creating a Core Data Model file in a Project or Framework will allow me to edit the model.
The second / follow up question would be how would I then extend the code-gem'd model files as normal? And how would I load that model definition (normally I would use a Bundle ID and the model file name)
I have tried adding the model file to the resources array of the Package.swift file (using .process and using .copy) as described on this page: https://developer.apple.com/documentation/swift_packages/bundling_resources_with_a_swift_package
Or more generally, is this even possible? (this article https://ishabazz.dev/blog/2020/7/5/using-core-data-with-swift-package-manager seems to imply that packaging core data models like this is possible)
(I am using Xcode 12.4)
...ANSWER
Answered 2021-Apr-07 at 17:27You need to create your Core Data model in an ordinary Xcode project, then you can create your package and drag the model to it. (This is also what was done in the linked article if you look carefully even though it was not clearly described).
I believe the the best thing is to manually generate the source code files for your entities and add them to your package. You load the model using Bundle
but instead of Bundle.main
you use Bundle.module
QUESTION
Using Swift-Package-Manager, Swift5.3.2, iOS14.4.1, XCode12.4,
I am trying to integrate Firebase into my iOS App.
I use the Swift Package Manager for Firebase (Beta) as described here.
After successfully integrating most packages from the Firebase selection choice (since I need most of them), I get the following error in Xcode:
'openssl/arm_arch.h' file not found
It seems to happen in the File crypto.c
of the BoringSSL
dependency added by the Firebase dependency. (see screenshot)
I know the problem has be described before (such as here, here, here and here). However, most of the people use Cocoapods. But in my case, I use the Swift Package Manager. So I open up this question again:
What do I need to do when Xcode said 'openssl/arm_arch.h' file not found
?
ANSWER
Answered 2021-Mar-26 at 14:35Yes, as is referenced in the comments, 7.9.0 was initially a bad release for the Firebase Swift Package Manager distribution. It was fixed and the 7.9.0 repo tag updated but Xcode/SPM caching prevented the new tag from being honored for people rerunning, so we made an equivalent 7.9.1 release to definitively fix the issue.
Full details at https://github.com/firebase/firebase-ios-sdk/issues/7777
QUESTION
Goal is to host a git repo for a Swift Package to distribute proprietary code as a binary in a XCFramework. The source code has dependencies on other Swift Packages. Listing the dependencies in the .package config is not enough. Simply asking consumers to import dependencies is not an option, as they may be making use of the same packages at different levels. The main problem I am trying to solve is how to resolve these dependencies when my Swift Package is imported into a project.
- Each dependency package should be archived and wrapped into the XCFramework as well, right?
- How would I do that?
The packages I am using are also available in a CocoaPod as well.
- Would it be easier to import them as pods for the purpose of archiving?
I have gone thru the following resources and SO posts, but can not find answer to this specific purpose.
- https://developer.apple.com/documentation/swift_packages/distributing_binary_frameworks_as_swift_packages
- https://developer.apple.com/videos/play/wwdc2019/416/
- https://medium.com/@anuragajwani/how-to-distribute-compiled-universal-ios-xcframeworks-using-swift-package-manager-8eaf8395985f
- https://www.appcoda.com/xcframework/
- Explicitly manage Swift Package nested dependencies required?
- XCFramework with Pods Dependencies (solution is to host a pod and not a swift package)
ANSWER
Answered 2021-Feb-17 at 16:41I faced into same issue couple of months ago and haven't found a proper solution so I just started to use Cocoapods for distribution and this script for archiving my framework target which have some Cocoapods as a dependencies:
QUESTION
I created my first Swift package by following this article on medium and added it to a Swift project. I can build and run the project containing the package (and many other packages) on simulators fine, but Product > Archive generates errors in my Swift package. The errors all seem to suggest that SwiftUI has not been imported, when it has.
Here's a snippet of the code with a few of the errors:
...ANSWER
Answered 2021-Feb-11 at 13:10Please add supported platforms to your Package.swift.
This could look like this:
QUESTION
I know this is common question but none of the solution working for me.
I've a swift package hosted on private repo in azure devops. In pipeline, i've setup task Install SHH key following document with passphrase and locally swift package resolve, authentication success. But in pipeline it fails with message "SSH fingerprint fail to verify".
I searched a-lot and there are few links below sharing, solution i've tried so far Adding identity to known_host, manually calling swift package resolve.
https://discuss.bitrise.io/t/xcode-11-resolving-packages-fails-with-ssh-fingerprint/10388
https://bonkowski.net/posts/ios-azure-pipeline/
I'm not sure, is there any way to get detail logs?
...ANSWER
Answered 2020-Nov-27 at 09:21Resolved, it was because of dev.azure.com it should be ssh.dev.azure.com, while adding host entry to known_hosts.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install swift-package-manager
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page