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 results found
Sort by:
Post marked as solved
1.8k Views

Xcode 12.5 stays in a loop "Resolving Swift Packages" until it slows down to a crawl

Today, after Xcode 12.5 upgraded, when I try to work on my projects, Xcode keeps running "Resolve Swift Packages" every second or so, this means that it both keeps flashing the display the whole time - it never settles, and it also keeps the machine busy and eventually, Xcode becomes unusable. This has a movie showing what my Xcode looks like tonight, the pauses in the video are caused by Xcode not responding to scrolling, since I left that thing idling while I had dinner: tirania.org/tmp/xcode-hang.mov This can be reproduced by downloading github.com/migueldeicaza/SwiftTerm and opening either the Swift solution or the Xcode projects. I have submitted a bug report.
Asked Last updated
.
Post marked as solved
2.6k Views

Xcode Previews doesn't work when used in a package that imports other packages.

I keep getting a Xcode Previews error in Xcode 12 from a package that imports other packages. As soon as I remove the dependency I'm able to see the SwiftUI preview. I'm only able to use previews in packages that have no dependencies The error I get is: "LoadingError: failed to load library at path...Library not loaded " then it point to the dependency that it could not load in the current package. How can I access Xcode Previews from a package that depends on other packages?
Asked
by iamlogiq.
Last updated
.
Post not yet marked as solved
196 Views

Xcode Cloud not working with local packages

Hi, I'm trying out Xcode Cloud but can't get it to build in my scenario. The use case is the following: My project has multiple swift packages that depend on each other. "App" has a local package dependency called "SPMKit". "SPMKit" has a local package dependency called "SPMKit2". The issue I run into is if "SPMKit2" has any dependencies, it doesn't resolve in Xcode Cloud. Are local dependencies like this not supported in Xcode Cloud? All the packages are in the same directory as my app. I'd like to not have to put each package in it's own git..
Asked
by Joebayld.
Last updated
.
Post not yet marked as solved
47 Views

[For simulator] How to build Swift packages as x86_64 in Xcode and M1 mac (Apple silicon) without using rosetta

On M1 mac (Apple Silicon chips), Xcode runs on arm64. How can we build the packages as x86_64 in SwiftPM that integrates with Xcode? Xcode builds the target as arm64 for simulator unless specifying excluded archs option. In some cases, the project would be forced to use x86_64 for simulator build since using external prebuilt frameworks only have arm64 for the device and x86_64 for the simulator. with specifying EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64 However, I could not find a way to specify that in the packages managed by SwiftPM. From this, Xcode builds packages as arm64 then builds application target as x86_64, linking phase would fail with not found modules in the arch. What can we do when we are forced to use still x86_64 on M1 mac?
Asked Last updated
.
Post not yet marked as solved
264 Views

module compiled with swift 5.3.2 cannot be imported by the swift 5.5.2 compiler

Hello, When trying to open a project written in approximately August in xcode 13.2.1 version, I get the error 'module compiled with swift 5.3.2 cannot be imported by the swift 5.5.2 compiler'. As you can see in the attachment, I get 127 errors when I run it with the 5.3.2 toolchain. How can I upgrade an existing project to version 5.5.2? Thank you in advance for your help
Asked Last updated
.
Post not yet marked as solved
25 Views

How to prevent Xcode builds Swift packages for all arches except using Debug configuration?

In Debug configuration, Xcode builds the packages for the currently active arch only. But if we create extra configuration by cloning Debug, those schemes make Xcode builds the packages for all architectures. It seems like Xcode misleading that the scheme is for release. How to specify the option to build for active arch only, like Xcode build settings ONLY_ACTIVE_ARCH?
Asked Last updated
.
Post not yet marked as solved
35 Views

Ideas for more contents on my dictionary app

Hello! I am a coding novice learning SWIFT alone for one year, now writing the first app in my life ( a Chinese dictionary) by adopting some source codes available online. I am thinking about enriching dictionary content. Below is from the swift file (DictionaryContent) where I store my dictionary contents let WORDS = [     "o": "I",     "oo": "You",     "ooo": "he", ] "lemma + meaning" seems just too simple. There should be definitely more infos , such as phonetics, POS, example etc. I have thought about perhaps using Struct to store data, but dunno how to put it into practice... In addition, I think I shall also modify code on ViewController to correspond to the changes in DictionaryContent. However, I really have no clue how to change. Here is ViewController import UIKit class ViewController: UIViewController {     @IBOutlet weak var searchBar: UISearchBar!     @IBOutlet weak var tableView: UITableView!     var words: [String: String] = [:] //maybe this shall be modified?     var searchWords: [String: String] = [:] //maybe this shall be modified?     override func viewDidLoad() {         super.viewDidLoad()                  searchBar.delegate = self         tableView.delegate = self         tableView.dataSource = self         tableView.tableFooterView = UIView(frame: .zero)         self.loadWords()     }     func loadWords (){         self.words = WORDS     } } extension ViewController: UITableViewDataSource, UITableViewDelegate{     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {         return searchWords.keys.count     }     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {         let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: SuggestionTableViewCell.self), for: indexPath) as! SuggestionTableViewCell         print(cell)         let key = Array(searchWords.keys)[indexPath.row]         cell.wordLbl.text = key         cell.meaningLabel.text = searchWords[key] ?? ""         return cell     } } extension ViewController:UISearchBarDelegate{     func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {            self.searchWords = words.filter({ (key, value) -> Bool in                return key.contains(searchText)            })            tableView.reloadData()        } } Any advice would be wholeheartedly appreciated! Thanks in advance!
Asked Last updated
.
Post not yet marked as solved
68 Views

ITMS-90430: Invalid Swift Support - React Native

Hi, community, when I build my project I have the same reject from App Store: ITMS-90430: Invalid Swift Support - The file libswiftAVFoundation.dylib doesn’t have a signing ID. Sign the file, rebuild your app using the current public (GM) version of Xcode, and resubmit it I follow a procedure before the build, but this works one time on X times... cleanup pods - cd ios & pod deintegrate & pod update cleanup Xcode derived data - rm -rf ~/Library/Developer/Xcode/DerivedData/* clean build folder Product->Clean Build Folder in Xcode Specs below: OSX: big sure 11.4 XCode: 13.2.1 Libs: "native-base": "^2.15.2", "npm": "^7.10.0", "react": "17.0.1", "react-native": "0.64.1", "react-redux": "^7.2.4", "redux": "^4.1.0", "rxjs": "^6.6.7", "@types/react-native": "^0.64.0", "typescript": "^3.8.3" This bothers me ... I waste hours on builds. Regards AA
Asked
by Alfr3d.
Last updated
.
Post not yet marked as solved
4.2k Views

Xcode 12 git with "ssh://" and private key still broken

When I use my repository with an "ssh://" URL and a private/public key, Xcode throws a "username does not match previous request (-1)" error. command line git (and every other GUI Git tool I tried) work without problems. Unfortunately this is also a problem for Swift Packages making them unusable for me. Before you ask: Of course "swift package …" works without problems on the command line. The problem exist consistently on every Xcode 12 version so far including Xcode 12b3. Seems like the devs put a bad git library into Xcode and now just leave it like that.
Asked
by Roddi.
Last updated
.
Post marked as solved
7.9k Views

Xcode 13 "Missing package product" using local Swift Packages

I have a project I've been working off of for a few years now that makes use of local Swift Packages. In my workspace, I have a "Kit" project that generates a framework using several local Swift Packages as dependencies. In Xcode 12, the local Swift packages resolve correctly and compiles, but each beta of Xcode 13 gives me the error: "[ProjectName].xcodeproj Missing package product '[LocalSwiftPackage]'" Clearing the package cache, derived data, or restarting the application does not resolve the issue. Only Swift Packages that are remotely loaded from a URL are compiled correctly. Using local packages to separate module code, while still being able to edit in the same project, has been essential to my workflow and would hate to see Xcode 13 release with these breaking changes, and I have not seen this issue listed in the known issues for the Xcode 13 release notes. Has anyone else experienced this issue or found a workaround?
Asked Last updated
.
Post not yet marked as solved
2.0k Views

Unable to import local XCFramework module

Our project is split up into multiple Pods with CocoaPods and I'm currently trying to convert all of our podspecs to SPM. One of our projects has XCFramework dependencies that I'm trying to include from a local source, but my project files are complaining that the modules couldn't be found when I try to import them. Is there something I'm missing here? My Package.swift file looks something like this: // swift-tools-version:5.3 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package(     name: "MyPackage",     defaultLocalization: "en_us",     platforms: [         .iOS(.v12),         .watchOS(.v6),         .macOS(.v10_15)     ],     products: [         .library(             name: "MyPackage",             targets: [                 "MyPackage"             ]),     ],     dependencies: [     ],     targets: [         .target(             name: "MyPackage",             dependencies: [                 .byName(name: "LocalXCFramework")             ],             path: "Sources/"         ),                  .binaryTarget(             name: "LocalXCFramework",             path: "Frameworks/LocalXCFramework.xcframework"         )              ] ) In this example, if I try to import the modules from LocalXCFramework, I get an error saying it couldn't be found.
Asked Last updated
.
Post not yet marked as solved
55 Views

Binary XCFrameworks on Swift Playgrounds 4?

When attempting to load an SPM package with a binary XCFramework target the package importer spins for a bit and then nothing happens. Checking the iPad logs in Console shows an error: Failed to resolve package graph: <private> Tried multiple such packages and made sure they were working fine on Xcode. Is this feature explicitly disabled or is this a bug? Are there future plans with Swift Playgrounds to support binary XCFrameworks? Thanks.
Asked
by mcanel.
Last updated
.
Post not yet marked as solved
186 Views

How can I suppress warning that "Conversion to Swift 5 is available"?

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).
Asked
by simonw.
Last updated
.
Post not yet marked as solved
1.3k Views

dyld: Symbol not found: swift34swift50override_conformsToProtocol

I am getting following error from one of the pod frameworks while running the app (Build is a success). dyld: Symbol not found: __ZN5swift34swift50override_conformsToProtocolEPKNS_14TargetMetadataINS_9InProcessEEEPKNS_24TargetProtocolDescriptorIS1_EEPFPKNS_18TargetWitnessTableIS1_EES4_S8_E. Referenced from: X framework Expected in: frameworks/DeviceKit.framework/DeviceKit mac OS 10.15 Xcode 12.4 React native 0.63 cocoapods: 1.10.1
Asked Last updated
.
Post not yet marked as solved
105 Views

IOS Swift Playgrounds on iPad - enable Background modes

I’m building a simple app exclusively using Swift Playgrounds on the iPad - prefer not to get into Xcode if I can help it.. my MacBook is ancient (2011) and doesn’t support the newer Swift Xcode releases. My app needs it to play background audio but I haven’t been able to find any way to enable background modes outside of Xcode https://developer.apple.com/documentation/avfoundation/media_playback_and_selection/creating_a_basic_video_player_ios_and_tvos/enabling_background_audio Is there any way to do this without Xcode or will I need a newer Mac?
Asked Last updated
.