Swift Packages

RSS for tag

Create reusable code, organize it in a lightweight way, and share it across Xcode projects and with other developers using Swift Packages.

Swift Packages Documentation

Posts under Swift Packages tag

199 Posts
Sort by:
Post not yet marked as solved
0 Replies
190 Views
xcode 13.4 trying move from fat to xcframework. I create the package by: 'swift package init --type library`; Move our sources to Source folder; Generate archive for iOS: xcodebuild archive -scheme TestFramework \ -destination "generic/platform=iOS" \ -archivePath ./Archive-iOS \ -derivedDataPath ".build" \ SKIP_INSTALL=NO \ BUILD_LIBRARY_FOR_DISTRIBUTION=YES . Generate archive for iOS Simulator: xcodebuild archive -scheme TestFramework \ -destination "generic/platform=iOS Simulator" \ -archivePath ./Archive-iOSSimulator \ -derivedDataPath ".build" \ SKIP_INSTALL=NO \ BUILD_LIBRARY_FOR_DISTRIBUTION=YES Generate the xcframework by docs: xcodebuild -create-xcframework \ -framework './Archive-iOS.xcarchive/Products/Library/Frameworks/TestFramework.framework' \ -framework './Archive-iOSSimulator.xcarchive/Products/Library/Frameworks/TestFramework.framework' \ -output './Archive-iOS.xcarchive.xcframework' got error: error: unable to read the file -> ./Archive-iOS.xcarchive/Products/Library/Frameworks/TestFramework.framework/TestFramework Ofc, because on steps 3,4 I haven't this framework in archive. Where can I found correct documentation with step by step for make xcframeworks?
Posted Last updated
.
Post not yet marked as solved
2 Replies
261 Views
I'm trying to compile an Xcode project. I'm getting 2 runtime errors: No such module 'Amplify & /Users/????????/Library/Developer/Xcode/DerivedData/screener_app-gkvpndyzdgqrsreqyokgisatdzav/Build/Intermediates.noindex/screener_app.build/Debug-iphonesimulator/screener_app.build/Objects-normal/x86_64/AuthButtonView.dia:1:1: warning: Could not read serialized diagnostics file: error("Invalid diagnostics signature") (in target 'screener_app' from project 'screener_app') Command CompileSwift failed with a nonzero exit code The screenshot is seen below. I have tried a handful of things: cleaned build folder install/update pods removedderived data I'm not sure what to do from here. Any advice is appreciated.
Posted
by tenicho.
Last updated
.
Post not yet marked as solved
1 Replies
1.2k Views
I have a Swift package that i've been working on for a while. I upgraded to Xcode 13 a month or two ago. I have a couple of large JS files in my package (third party NPM libraries that I can't re-write). Randomly, Xcode will throw an error (but not a real error because I can continue as normal) that It can't load the folder containing the JS files This doesn't prevent me from doing anything, but its irritating to have this error constantly showing up. Is there anything I can do to solve this or is this an Xcode bug?
Posted
by simonmcl.
Last updated
.
Post not yet marked as solved
1 Replies
426 Views
Hi, I am unable to upload my app with mac book pro (13 inch ,M1) , Xcode 13.2.1 (13C100), swift 5, and cocoapods-1.10.1 version, receiving following mail from App Store connect after 10 mins of upload to TestFlight or AppStore. Error : We identified one or more issues with a recent delivery for your app, "MyApp" 1.4.6 (89). Please correct the following issues, then upload again. ITMS-90429: Invalid Swift Support - The files libswiftDarwin.dylib, libswiftMetal.dylib, libswiftCoreAudio.dylib, libswiftsimd.dylib, libswiftQuartzCore.dylib, libswift_Concurrency.dylib, libswiftos.dylib, libswiftObjectiveC.dylib, libswiftDispatch.dylib, libswiftCoreLocation.dylib, libswiftAccelerate.dylib, libswiftCoreGraphics.dylib, libswiftCoreData.dylib, libswiftCoreFoundation.dylib, libswiftUIKit.dylib, libswiftCoreMedia.dylib, libswiftAVFoundation.dylib, libswiftCore.dylib, libswiftFoundation.dylib, libswiftPhotos.dylib, libswiftMediaPlayer.dylib, libswiftCoreImage.dylib aren’t at the expected location /Payload/MyApp.app/Frameworks. Move the file to the expected location, rebuild your app using the current public (GM) version of Xcode, and resubmit it.
Posted Last updated
.
Post not yet marked as solved
0 Replies
152 Views
failed to read asset tags: The command (cd /Users/Stark/Downloads/hyundai_msrm && /usr/bin/actool --print-asset-tag-combinations --output-format xml1 /Users/Stark/Downloads/hyundai_msrm/hyundai_msrm/Assets.xcassets) exited with status 1. The command's output was: xcrun: error: invalid active developer path (/Applications/Xcode.app/Contents/Developer), missing xcrun at: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun i was wondering that matter if i have older or newest version of xcode ? or is there other error ?
Posted
by stark5533.
Last updated
.
Post not yet marked as solved
1 Replies
765 Views
Hi, building swift package - https://github.com/SAP/cloud-sdk-ios-fiori with Xcode 12.1 and the following command xcodebuild -enableCodeCoverage YES -derivedDataPath Build/ -scheme FioriSwiftUI-Package -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=14.1,name=iPhone 11' clean build test results in the following error: Error: Mismatch between existing container extension: <DVTExtension 0x7fd732e56260: Swift User Managed Package Folder (Xcode.IDEFoundation.Container.SwiftPackageUserManagedFolder) from com.apple.dt.IDE.IDESwiftPackageSupport> and requested container extension: <DVTExtension 0x7fd732e56750: Swift Package Proxy (Xcode.IDEFoundation.Container.SwiftPackageProxy) from com.apple.dt.IDE.IDESwiftPackageSupport> for file path: <DVTFilePath:0x7fd738728c30:'/Users/d041771/git/cloud-sdk-ios-fiori/Build/SourcePackages/checkouts/observable-array'> Why? How is it possible to build with -derivedDataPath without requiring a xcodeproj file? Note Building without -derivedDataPath works Building with -derivedDataPath and specifying -project works but is not an option for us as the package shall embed localized resources (swift-tools-version 5.3) in the future and building with xcoceproj will not work then - https://developer.apple.com/forums/thread/650278
Posted Last updated
.
Post not yet marked as solved
1 Replies
240 Views
finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 “The request timed out.” UserInfo={_kCFStreamErrorCodeKey=-2102, NSUnderlyingError=0x282fbd800 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 “(null)” UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask &lt;7060BA29-10BA-40C9-91AB-DCA082E5F038&gt;.&lt;235&gt;, _NSURLErrorRelatedURLSessionTaskErrorKey=(  “LocalDataTask &lt;7060BA29-10BA-40C9-91AB-DCA082E5F038&gt;.&lt;235&gt;” ),NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=&lt;xyz.com&gt;, NSErrorFailingURLKey=&lt;xyz.com&gt;, _kCFStreamErrorDomainKey=4} getting this issue in some rare scenario, unable to find solution for this? anyone can help to resolve this? because of this issue some times app stucks with loader screen and unable to work further. I just replaced our server url with &lt;xyz.com&gt;. I have checked with iPad 3rd generation.
Posted
by nfnlabs.
Last updated
.
Post not yet marked as solved
0 Replies
205 Views
I tried everything in this post It is no effect https://developer.apple.com/forums/thread/687275 For example, clean Build folder and remove DerivedData File -&gt; Packages -&gt; Reset Package Caches or File -&gt; Packages -&gt; Update To Latest even removed all the embedded frameworks and re-added them
Posted
by Travisxu.
Last updated
.
Post not yet marked as solved
0 Replies
146 Views
OS: macOS 12.3.1 21E258 arm64 Host: MacBookPro18,3 Kernel: 21.4.0 Xcode: 13.3.1 (13E500a) I used to have the correct flow new file -> choose file template (Swift File) -> save as (name the file). Now I have the wrong flow new file -> choose file template (Swift File) xcode not show up the save as dialog, just give me File.swift directly. This problem only happend if I open the swift package directly. When I do swift package generate-xcodeproj, and open with .xcodeproj. It will work correctly. Does any one know how to fix this?
Posted Last updated
.
Post marked as solved
1 Replies
271 Views
Good day I am developing XRKit framework, which contains the pipeline logic for rendering using Metal, in manifest it has two targets - framework itself in Swift and XRKitDefenitions in C++ and MSL (since Apple forbids us multilingualism in one package). Both targets have Resources folders open in their manifest. When I try to access the test files hello01.txt (Resources for XRKit) and hello2.txt (Resources for XRKitDefenitions) via Bundle.module, I only see hello01.txt and it doesn't read hello2.txt because it's in a different target. How do I properly organize my code with SPM to access the Resources of XRKitDefenitions target? PS When trying to organize XRKitDefenitions as a remote package on GitHub and defining it as a dependency, situation does not change. I understand now that Bundle.module only refers to its Resources. Is there a way to refer to resources that provided other targets or dependencies in the same package?
Posted Last updated
.
Post marked as solved
1 Replies
192 Views
Some time ago I was trying to use a Swift package, but there was an issue in the github repo, so I forked it, fixed it and pointed Xcode towards my fork. I contacted the team and they resolved the issue. I want to go back to using the official version, but Xcode will only pick up my fork. Even if I delete my fork, Xcode thinks it might be private access and is asking me for new credentials, rather than using the url i'm supplying. I've tried removing the dependency, clearing cache, derived data, package.resolved, restarted Xcode, restarted MacOS etc. Nothing seems to work. You can see in the below picture i've typed in https://github.com/airgap-it/... but its complaining that it can't find https://github.com/simonmcl/... Anyone have any idea how to clear whatever is lingering around?
Posted
by simonmcl.
Last updated
.
Post not yet marked as solved
1 Replies
187 Views
Hey My name is Denvour, I recently completed my final project but can not turn it in due to the fact that I've messed one of my files. One of the files aren't in the folder and I really need to turn this in within the next hour or I'm going to fail my Senior Year. This is the error code below. "Build input files cannot be found: '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/BoardBrown.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/AppDelegate.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/BoardItemBrown.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/Board.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/BoardCellBrown.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/Turn.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/TurnBrown.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/SceneDelegate.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/Brown3.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/BoardItem.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/BoardCell.swift', '/Users/appdev/Desktop/Connect Da'DotsImportant1/Connect Da'Dots/ViewController.swift' (in target 'Connect Da'Dots' from project 'Connect Da'Dots.Important')"
Posted
by denvour.
Last updated
.
Post not yet marked as solved
0 Replies
139 Views
We are working on an app that manage receiving material and we need to take picture of the material and save it to the network (share drive). We try all kind of tools Ex. AMSMB2 and we are not able to. I am sure I am not the only one trying to do that. :) Thank you for the help Christian
Posted
by Chris00.
Last updated
.
Post marked as solved
16 Replies
11k Views
I have compiled Google's WebRTC library and bundled up everything into xcframework in order to distribute as a binary framework in Swift package manager. When I add the package to my project it compiles and runs on a simulator. However, on a physical device, it crashes on launch with the following error: dyld: Library not loaded: @rpath/WebRTC.framework/WebRTC Referenced from: /private/var/containers/Bundle/Application/AA9F8C9C-7EF4-4556-8848-1EEFE1785658/WebRTC-Demo.app/WebRTC-Demo Reason: image not found dyld: launch, loading dependent libraries DYLDLIBRARYPATH=/usr/lib/system/introspection DYLDINSERTLIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib Further investigation: After archiving the project and exporting ipa file, the ipa file is missing the binary framework and still crashing on launch. Removing the Swift package and attaching the xcframework manually (by drag and drop) works on Simulators and physical devices. Tech specs XCFramework created on macOS 10.15.5 with Xcode 11.5 Used Xcode 12.0 beta 1 on macOS 10.15 for the app which uses the framework. I got the error above on iPhone X and iPad pro 10.5" Used the following Package.swift - https://github.com/stasel/WebRTC-iOS/blob/xcode-12/Package.swift file. Framework download link can be found in the Package.Swift file above. Any suggestions/insights would be helpful. Thanks!
Posted
by stasel.
Last updated
.
Post not yet marked as solved
6 Replies
3.4k Views
I have been able to ship some image and asset catalogs in a Swift package with success using Xcode 12b1 and Swift 5.3. I am not having so much luck with using a custom .ttf file in a Swift Package. I am loading a .ttf file in the manifest like so: .target( &#9;name: "BestPackage", &#9;dependencies: [], &#9;resources: [ &#9;&#9;.copy("Resources/Fonts/CustomFont.ttf"), &#9;&#9;.process("Resources/Colors.xcassets") &#9;] ), And I noticed that there's no initializer on the Font type in SwiftUI to include an asset from a module. For example, this works: static var PrimaryButtonBackgroundColor: SwiftUI.Color { &#9;Color("Components/Button/Background", bundle: .module) } However, there's no way to specify where a font is coming from. I was hoping that loading it into the module would emit it into the target for use, but no such luck: static var PrimaryButtonFont: Font {   Font.custom("CustomFont", size: 34) } This does not load the font as expected. I'm investigating using a CoreText api to try and trick it into loading, but I feel like there should be an easier way. Any advice?
Posted
by dokun1.
Last updated
.
Post not yet marked as solved
0 Replies
164 Views
I'm building a swiftUI project for ios and trying to connect a Firebase/FireStore DB to the project using Swift Package Manager and importing; firebase-ios-sdk. In doing so, I get a Package Resolution Failed message with a box and list of all the firebase-ios-sdk that could not be resolved. I tried deleting the derived data folder content, resetting package caches, resolving the package version, restart Xcode. Nothing worked. Last night I uninstalled Xcode and re-installing Xcode overnight. Did not work, still the same issue today. When I import Firebase to the .swiftui file, I get a code error message - No such module 'FirebaseCore'
Posted
by A3aan.
Last updated
.
Post not yet marked as solved
2 Replies
396 Views
When we do these steps, Xcode crashes everytime we add a new file. Build and run our project Add a file to our local Swift Package Modify the newly added file Try to build the project Observe crash. I filed a Radar with the crash report here: https://openradar.appspot.com/radar?id=5594745317359616
Posted
by sami.taha.
Last updated
.
Post marked as solved
2 Replies
340 Views
Hi, I have a WebView based app, I want any external links within the default website in the WebView to open in a new Safari browser tab rather than within the Website I am displaying through the app. In the ViewController, I have: import UIKit import WebKit import CoreLocation class ViewController: UIViewController, WKNavigationDelegate { var webView: WKWebView! override func loadView() { webView = WKWebView() webView.navigationDelegate = self view = webView let url = URL(string: "https://domain.com")! webView.load(URLRequest(url: url)) webView.allowsBackForwardNavigationGestures = true webView.navigationDelegate = self } func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { if let url = navigationAction.request.url { if url.host != "https://domain.com" { UIApplication.shared.open(url) decisionHandler(.cancel) return } } decisionHandler(.allow) }} But, rather than it opening a new Safari browser when you tap onto an external link, when the app launches, the website I have contained within the app opens in Safari. Is there anything I can do to try and resolve this issue? Any help is appreciated.
Posted
by dafo.
Last updated
.
Post not yet marked as solved
6 Replies
2.5k Views
After upgrading to Xcode 13.2 I receive a warning that "Conversion to Swift 5 is available". If I click the warning then a target conversion window appears allowing me to select which targets should be migrated. My project uses a large number of Swift packages and this list contains 76 targets. 73 of these targets are from packages that target swift-tools-version: 5 or newer. The other 3 packages have swift-tools-version set to 4.x. Unfortunately these are open-source packages that I cannot change. If I try to run the migration it stops with an error that the project could not be built, with no additional information. This is incorrect as the project and all dependencies build fine. The warning is not removed if I click "Convert Later", even if "Remind Me" is unchecked. The Swift compiler version for the top-level Xcode project is set to 5. I don't understand why I'm getting this warning as it did not appear with Xcode 13.0 or 13.1. Is there a way to suppress this warning? We have a zero warning policy for our projects so I need to resolve or suppress this warning, at least for the current Xcode version (13.x).
Posted
by simonw.
Last updated
.