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.

Posts under Swift Packages tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Linker command failed due to Undefined Symbol errors.
Xcode will build and analyze fine using the Debug build configuration but trying to use Analyze or Archive with Release configuration generates 3 errors: Undefined symbol: protocol conformance descriptor, Undefined symbol: type metadata accessor, and Undefined symbol: nominal type descriptor causing the linker to command to fail. The library is included and already linked and a previous version did not have the error so I think it's a code issue but not quite sure what it is or how to fix! The project/package can be found here: https://github.com/kudit/Device/tree/v2.1.17 (to reproduce, checkout this version and rename appending ".swiftpm" to the folder, then right-click to show package contents, open the Development folder and open the Xcode project there. It's done this way so the package can be imported and edited on iPad Swift Playgrounds)
2
0
688
Oct ’24
Test Swift Package that vends XCFramework and has dependencies in example app before distribution
I've created a closed source iOS SDK from a local Swift package, which has dependencies on other Swift packages, and successfully created a binary XCFramework following the solution from my previous post. I would now like to create a Package.swift to vend this XCFramework and test it in an example app to verify it works as expected before I upload it to a public repo for distribution. I understand that binaryTarget does not support dependencies so we need to use a wrapper. I created a directory containing the following: Package.swift MyFramework.xcframework/ MyFrameworkWrapper/ ├─ dummy.swift Package.swift contains: // swift-tools-version: 5.10 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "MyFramework", platforms: [ .iOS(.v14) ], products: [ .library( name: "MyFramework", targets: ["MyFramework", "MyFrameworkWrapper"] ) ], dependencies: [ .package(url: "https://github.com/gordontucker/FittedSheets.git", from: "2.6.1") ], targets: [ .target( name: "MyFrameworkWrapper", dependencies: [ "FittedSheets" ], path: "MyFrameworkWrapper" ), .binaryTarget( name: "MyFramework", path: "MyFramework.xcframework" ) ] ) I created a new iOS app, selected the project, Package Dependencies > + > Add Local, and added the directory containing this Package.swift. Xcode resolves the dependencies and lists them in the sidebar. I added code to import and use the framework. It builds successfully but the app crashes when run: dyld[63959]: Library not loaded: @rpath/FittedSheets.framework/FittedSheets Referenced from: <7DE247FC-DAFF-3946-AD21-E80F5AF841C9> /Users/Jordan/Library/Developer/Xcode/DerivedData/MyFramework-Example-gaeeymnqzenzrbbmhuebpodqctsz/Build/Products/Debug-iphonesimulator/MyFramework.framework/MyFramework How do I get this working? I'm wondering is my package set up properly to vend the framework specifying its dependencies, and is my XCFramework created correctly? The Package.swift for the framework's source code contains: // swift-tools-version: 5.10 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "MyFramework", platforms: [ .iOS(.v14) ], products: [ .library( name: "MyFramework", type: .dynamic, targets: ["MyFramework"] ) ], dependencies: [ .package(url: "https://github.com/gordontucker/FittedSheets.git", from: "2.6.1") ], targets: [ .target( name: "MyFramework", dependencies: [ "FittedSheets" ], path: "Sources" ) ] ) And I created the XCFramework following the steps in that previous thread: Create archive from package via xcodebuild archive -workspace "$PACKAGE_PATH" -scheme "$FRAMEWORK_NAME" -destination 'generic/platform=iOS' -archivePath "$ARCHIVE_PATH/iOS" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES ENABLE_USER_SCRIPT_SANDBOXING=NO ENABLE_MODULE_VERIFIER=NO OTHER_SWIFT_FLAGS=-no-verify-emitted-module-interface Create the Modules directory in the framework via mkdir -p "$ARCHIVE_PATH/iOS.xcarchive/Products/usr/local/lib/$FRAMEWORK_NAME.framework/Modules" Copy the Swift interface files into the framework from the build in DerivedData via cp -a "$BUILD_PRODUCTS_PATH/Build/Intermediates.noindex/ArchiveIntermediates/$FRAMEWORK_NAME/BuildProductsPath/Release-iphoneos/$FRAMEWORK_NAME.swiftmodule" "$ARCHIVE_PATH/iOS.xcarchive/Products/usr/local/lib/$FRAMEWORK_NAME.framework/Modules" Repeat 1-3 for iOS Simulator Create an XCFramework via xcodebuild -create-xcframework -framework "$ARCHIVE_PATH/iOS.xcarchive/Products/usr/local/lib/$FRAMEWORK_NAME.framework" -framework "$ARCHIVE_PATH/iOS_Simulator.xcarchive/Products/usr/local/lib/$FRAMEWORK_NAME.framework" -output "$ARCHIVE_PATH/$FRAMEWORK_NAME.xcframework"
0
1
483
Jun ’24
VISIONOS: how to detect if the user closes a window vs a window going into the background
For context, we have a fully immersive application running on visions. The application starts with a standard View/menu, and when the user clicks an option, it takes you to fully immersive mode with a small floating toolbar window that you can move and interact with as you move around the virtual space. When the user clicks the small x button below the window, we intercept the scenePhase .background event and handle exiting immersive mode and displaying the main menu. This all works fine. The problem happens if the user turns around and doesn't look at the floating window for a couple of minutes. The system decides that the window should go into the background, and the same scenePhase background event is called - causing the system to exit immersive mode without warning. There seems to be no way of preventing this, and no distinction between this and the user clicking the close button. Is there a reliable way to detect if the user intentionally clicks the close button vs the window from going into the background through lack of use? onDisappear doesn't trigger. thanks in advance
1
1
666
Jun ’24
Distribute XCFramework that has dependencies on Swift Packages with Example project
I've created a closed source iOS SDK from a local Swift package, which has dependencies on other Swift packages, and successfully created a binary XCFramework following the solution from my previous post. Now I'm proceeding with the process to distribute this SDK. I believe I want to upload the XCFramework to a public repo alongside a Package.swift file and an Example app project that uses the XCFramework. So each time I go to create a new release I’ll create a new XCFramework replacing the current one, verify it's working properly in the example app, then commit, tag, and push to the repo. My question is how do I set this up as a Swift package that includes an example app that uses the local XCFramework (not a remote url to a zip of the framework) and properly resolves dependencies? So far I created a directory containing MyFramework.xcframework and Package.swift containing: // swift-tools-version: 5.10 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "MyFramework", platforms: [ .iOS(.v14) ], products: [ .library( name: "MyFramework", targets: ["MyFramework"] ) ], dependencies: [ .package(url: "https://github.com/example/example.git", from: "1.0.0") ], targets: [ .binaryTarget( name: "MyFramework", path: "MyFramework.xcframework" ) ] ) I then created an Example iOS app project in that directory and now need to integrate the local XCFramework. I wondered if I could do that via File > Add Package Dependencies > Add Local, but when I navigate to that Package.swift and click Add Package it says The selected package cannot be a direct ancestor of the project. Do I need a different Package.swift for the Example app, and if so, how do I get that set up? I created a separate Package.swift (contents below) alongside the xcodeproj but when I try to add that in Xcode I get the same error, despite the fact this package is a sibling of the project not an ancestor. // swift-tools-version: 5.10 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "MyFramework-Example", platforms: [ .iOS(.v14) ], dependencies: [ .package(name: "MyFramework", path: "../") ], targets: [ .target( name: "MyFramework-Example", dependencies: ["MyFramework"] ) ] )
1
0
666
Jun ’24
Switch between distributing code as source / as a binary
I'm getting confused reading conflicting information about Swift Packages (for example, many sources say its for distributing source code only, but Apple's documentation says a binary framework can be included in them). What I would like to be able to do is to distribute a project as a binary to external customers (so they cannot see the source code) but distribute it as source code for internal consumption (so when developing a test app that uses the project, source code can be stepped through in the debugger etc.) Is the feasible/easy? Could a package manifest be created that can easily be flipped between creating a package containing source only, and a binary only. Or would it be better to have two separate manifests?
1
0
389
Jun ’24
Options for switching between incorporating binary and/or source code within an app
Our company is going to develop an iOS library of functionality for inclusion in several apps, some of the apps will be developed in-house and some externally. When the library is included in external apps the source code shouldn't be visible. When the library is included in internal apps, having the option to view and step through the code within the library will be invaluable for debugging. How could I set things up so that two forms of the library can be easily generated - one exposing source code and the other not. Ideally they should be capable of being incorporated within the apps in the same manner regardless of if the source code is expose or not Is that possible? I looked at Swift Packages, but it seems its for distribution of source code only, and its not possible to hide the source code. However, conversely, a framework only contains binary and no source code. Is there any other option?
0
0
290
Jun ’24
Build XCFramework from source that has dependencies on Swift Packages
I’m looking into building a closed source XCFramework from a local Swift package that has dependencies on other packages, which can later be distributed via Swift Package Manager. In initial discussions, we thought xcodebuild does not support linking the dependencies externally, it always includes them statically in the built framework. It's my understanding this is because we're asking xcodebuild to build a framework from a local Swift Package. Is there another way this can be achieved? To explain in more detail: I have built a closed source SDK for other developers to integrate in their apps, currently distributed as an XCFramework. The interesting thing about the SDK is it has dependencies on other libraries, which need to be resolved when adding this SDK as a dependency to an app. The SDK’s dependencies should not be baked into our XCFramework. CocoaPods has worked well for that but we want to instead use SPM. The current project setup is an iOS framework Xcode project and an app Xcode workspace. The framework project is included in the app workspace and is in the same repo as the app, which allows me to modify the framework source code then run the app to test it. The framework project can also be opened independently and built to verify it doesn’t have any errors, but to verify it’s working I run it with the app. To distribute a new release I use xcodebuild to create an XCFramework and then deploy that. For this to work with CocoaPods I had to add a Podfile to the app directly as well as the framework directory so both have the dependencies available. This means I have an xcworkspace for the framework and not just a xcodeproj. I specify the framework workspace file in the xcodebuild command. To switch to a setup that utilizes Swift Package Manager, I created a Package.swift in the iOS framework project’s directory that specifies its dependencies, removed CocoaPods integration including deleting the workspace file, removed the framework project from the app’s workspace, added the Package as a local package to the app project, and added the framework directory via + > Add Files to “App” which adds the package to the top of the sidebar, making its source code available to edit within the app workspace. Everything is working when I run the app. Xcode properly resolves the dependencies for the local package and I can run the app to develop it. Now to create an XCFramework I run the following command in the framework directory (which contains the Package.swift): xcodebuild archive -workspace . -scheme FrameworkName -configuration Release -destination 'generic/platform=iOS' -archivePath './build/FrameworkName.framework-iphoneos.xcarchive' SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES ENABLE_USER_SCRIPT_SANDBOXING=NO This succeeds however the dependencies have been linked statically thus included in our SDK. We need to only include the code from our framework and link to external dependencies, like it does with our current CocoaPods setup. I'm wondering what options there are to achieve this. Even if I need to change the project setup locally, for example to continue using a framework project/workspace instead of a local Swift package. It seems I just need xcodebuild to be able to create an XCFramework which can then be distributed with its own Package.swift file that specifies its dependencies. If it's not possible to link the dependencies externally, could you help me to understand the implications of including them statically? I don't know what problems could arise as a result of that or other concerns this would bring. Thanks!
1
1
1.3k
Jun ’24
Compiling the JPEG-XL reference for iOS, or, "Is compiling C++ for iOS really this difficult!?"
I'm trying to add JPEG-XL encoding/decoding capabilities to my app and haven't been able to find a trustworthy pre-compiled version. The only one I've found is in https://github.com/awxkee/jxl-coder-swift. As a result I've been trying to compile my own iOS version from the reference implementation (https://github.com/libjxl/libjxl), having done virtually no compiling before. When I started out, my gut said, "Compiling for a different platform should be easy since it's not like I'm actually writing or modifying the implementation", but the more I research and try, the more doubtful I've become. So far I've figured out it means compiling all the dependencies (brotli, highway, libpng, skcms, etc.) too, but I've also gotten nowhere with them, having tried my hand at modifying cmake toolchains and CMakeList.txt files. As a novice, am I biting off more than I can chew with this? Is the seemingly simple task, "Compile this C++ library for iOS" actually something that freelancers charge huge amounts for? (If so, this makes the free compiled version mentioned above even more questionable) Any help or pointers would be greatly appreciated.
5
0
800
Jun ’24
SwiftUI Previews broken on local Swift Package with dependencies
I have a project with two local packages One client package with an interface and some models with dynamic type in the Package.Swift One feature package with the UI and a dependency to the client package When I try to preview a view that is not using any models or code from the client package, it loads just fine e.g. a view that is just a container to display things like a card But when I tried to preview any other view that actually uses models from the client package, it just fails the first few lines of the preview error display LinkDylibError: Failed to build <filename>.swift Linking failed: linker command failed with exit code 1 (use -v to see invocation) ld: warning: search path '/Applications/Xcode-15.4.0.app/Contents/SharedFrameworks-iphonesimulator' not found Undefined symbols for architecture arm64: Also, I'm using Xcode 15.4 and iOS 17 as the min version
5
1
868
Oct ’24
How to set up multi platform efficiently
Hello, so I have a SwiftUI app that is relatively large, and it has multiple targets, one for each platform. but as I near App Store release I'm feeling very confused as to how to configure it. One app was rejected because the Mac target's name becomes the app which is different from App Store (Texty+ [App Store] vs Texty+ Mac [on target]). So I then just combined all the files into one target with a #if os(Mac... iOS) etc, but is that the proper way for multi platform app. I know there is like a Multiplatform target but that would require I restructure all the files and that always leads to issues in this near release app.
0
0
464
Jun ’24
SwiftData Document-based app produces strange write errors
I have a document app built using SwiftData because frankly I'm too lazy to learn how to use FileDocument. The app's title is "Artsheets," and I'm using a document type that my app owns: com.wannafedor4.ArtsheetsDoc. The exported type identifier has these values: Description: Artsheets Document Identifier: com.wannafedor4.ArtsheetsDoc Conforms to: com.apple.package Reference URL: (none) Extensions: artsheets MIME Types: (none) And the code: ArtsheetsApp.swift import SwiftUI import SwiftData @main struct ArtsheetsApp: App { var body: some Scene { DocumentGroup(editing: Sheet.self, contentType: .package) { EditorView() } } } Document.swift import SwiftUI import SwiftData import UniformTypeIdentifiers @Model final class Sheet { var titleKey: String @Relationship(deleteRule: .cascade) var columns: [Column] init(titleKey: String, columns: [Column]) { self.titleKey = titleKey self.columns = columns } } @Model final class Column: Identifiable { var titlekey: String var text: [String] init(titlekey: String, text: [String]) { self.titlekey = titlekey self.text = text } } extension UTType { static var artsheetsDoc = UTType(exportedAs: "com.wannafedor4.artsheetsDoc") } I compiling for my iPhone 13 works, but then when creating a document I get this error: Failed to create document. Error: Error Domain=com.apple.DocumentManager Code=2 "No location available to save “Untitled”." UserInfo={NSLocalizedDescription=No location available to save “Untitled”., NSLocalizedRecoverySuggestion=Enable at least one location to be able to save documents.}
9
4
903
Sep ’24
Export localization not working when using packages due to unnecessary macOS compile
Hi This issue is present both in previous, current, and beta versions of Xcode When a project has localization in packages, Xcode FAILS to export localization The reason is that when trying to export in this configuration, the compiler will try to export using macOS sdk, but if the package support only iOS of course will not find symbols for frameworks and functions that are scoped only for iOS This behaviour is not changed when the platforms for the package includes ".macOS("99") has I've found as a suggestion online The only way to perform this operation is to run, from CLI the following command xcodebuild -exportLocalizations -localizationPath . -sdk iphoneos -project TranslateTest.xcodeproj -exportLanguage en The problem is that this command will not work when one of the packages contains a macro. The following error will return in CLI if the macro is used (if the package is only imported no error appears) error: external macro implementation type 'MyMacroMacros.StringifyMacro' could not be found for macro 'stringify' I've found online some suggestions from apple folks that says to replace -sdk iphoneos with -destination 'platform=iOS,name=Any iOS Device’ in case your project contains a macro, but this changes nothing in the final result, the export will fail I'm providing a zip for apple in the radar (cannot upload zip here) that contains 3 example project for the 3 cases: A project without any packages that can extract its strings with any mode A project with a package that can only extract its strings only by CLI A project with multiple packages, one of which has a macro, and it can never extract its string This problem affects any possibility to have a modularised application with localisations, macros, and packages. Feedback FB13902424
1
0
518
Jun ’24
Xcode 16 crash trying to remove a package dependency
Feedback Submitted FB13898610 Xcode crashes with below. Pressing the "-" to remove a package dependancy. Solutions most welcome Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6 Terminating Process: Xcode [27376] Application Specific Information: abort() called Application Specific Signatures: NSInvalidArgumentException Application Specific Backtrace 0: 0 CoreFoundation 0x00007ff815134dc6 __exceptionPreprocess + 242 1 DVTFoundation 0x000000011257fd3e DVTFailureHintExceptionPreprocessor + 448 2 libobjc.A.dylib 0x00007ff814c24e9d objc_exception_throw + 48 3 CoreFoundation 0x00007ff81504f400 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 604 4 CoreFoundation 0x00007ff81504f18a +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49 5 DevToolsCore 0x000000012118ca09 -[PBXTarget removePackageProductDependencies:] + 1053 6 DevToolsCore 0x00000001211b1c65 -[PBXTarget packageReferenceWillBeRemoved:] + 273 7 CoreFoundation 0x00007ff8150b742a -[NSArray makeObjectsPerformSelector:withObject:] + 252 8 DevToolsCore 0x000000012116200c -[PBXProject(PBXTargetedNotifications) packageReferenceWillBeRemoved:] + 267 9 DevToolsCore 0x0000000121157026 -[PBXProject removePackageReference:] + 219 10 Xcode3UI 0x0000000128db10c8 __56-[Xcode3PackageReferenceListViewController removeItems:]_block_invoke + 319 11 Xcode3UI 0x0000000128db0c7b -[Xcode3PackageReferenceListViewController removeItems:] + 1925 12 AppKit 0x00007ff81891e34d -[NSApplication(NSResponder) sendAction:to:from:] + 337 13 IDEKit 0x00000001162a8e5f __37-[IDEApplication sendAction:to:from:]_block_invoke + 315 14 DVTFoundation 0x000000011257f51d DVTInvokeWithFailureHint + 78 15 IDEKit 0x0000000116202bc0 -[IDEApplicationController application:setFailureHintMessage:duringBlock:] + 118 16 IDEKit 0x00000001162a8f2b -[IDEApplication _invokeWithFailureHint:block:] + 105 17 IDEKit 0x00000001162a8cb8 -[IDEApplication sendAction:to:from:] + 333 18 AppKit 0x00007ff81891e1c3 -[NSControl sendAction:to:] + 86 19 AppKit 0x00007ff81891e0f5 __26-[NSCell _sendActionFrom:]_block_invoke + 131 20 AppKit 0x00007ff81891dffe -[NSCell _sendActionFrom:] + 171 21 AppKit 0x00007ff81891df46 -[NSButtonCell _sendActionFrom:] + 96 22 AppKit 0x00007ff81891ae32 NSControlTrackMouse + 1823 23 AppKit 0x00007ff81891a6ef -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 125 24 AppKit 0x00007ff81891a5b6 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 666 25 AppKit 0x00007ff8189199ab -[NSControl mouseDown:] + 666 26 AppKit 0x00007ff818918353 -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 4582 27 AppKit 0x00007ff818891177 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 313 28 AppKit 0x00007ff818890e23 -[NSWindow(NSEventRouting) sendEvent:] + 345 29 IDEKit 0x0000000116269d6a -[IDEWorkspaceWindow sendEvent:] + 158 30 AppKit 0x00007ff819043470 -[NSApplication(NSEventRouting) sendEvent:] + 1456 31 IDEKit 0x00000001162a8a7f -[IDEApplication sendEvent:] + 308 32 AppKit 0x00007ff818bfe8de -[NSApplication _handleEvent:] + 65 33 AppKit 0x00007ff81872209a -[NSApplication run] + 640 34 IDEKit 0x00000001162a888a -[IDEApplication run] + 54 35 AppKit 0x00007ff8186f5ff3 NSApplicationMain + 816 36 dyld 0x00007ff814c59366 start + 1942 Kernel Triage: VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x7ff814fac14a __pthread_kill + 10 1 libsystem_pthread.dylib 0x7ff814fe4ebd pthread_kill + 262 2 libsystem_c.dylib 0x7ff814f0aa79 abort + 126 3 IDEKit 0x116226509 +[IDEAssertionHandler _handleAssertionWithLogString:assertionSignature:assertionReason:extraBacktrace:] + 1178 4 IDEKit 0x1162278c3 -[IDEAssertionHandler handleUncaughtException:] + 749 5 IDEKit 0x116227c00 IDEHandleUncaughtException + 94 6 IDEKit 0x1162a9370 -[IDEApplication reportException:] + 79 7 AppKit 0x7ff818722129 -[NSApplication run] + 783 8 IDEKit 0x1162a888a -[IDEApplication run] + 54 9 AppKit 0x7ff8186f5ff3 NSApplicationMain + 816 10 dyld 0x7ff814c59366 start + 1942
1
2
540
Jun ’24
Package.resolved modified unexpectedly when switching git branches outside of Xcode
We've recently increased our use of SPM in our iOS app's Xcode project. However, we've noticed that if the Xcode project is open when we switch to a different git branch using another tool (e.g. git on the command line or in a 3rd-party GUI), the Package.resolved file is modified unexpectedly. We've received some conflicting advice about the purpose and appropriate treatment of the Package.resolved file. Some say to add it to .gitignore. On the other hand, the docs say: …be sure to commit your project’s Package.resolved file to your Git repository. This ensures a reliable CI workflow that always uses the expected version of a package dependency. For now, our workaround is to use Xcode to switch git branches, but this seems like an unusual limitation. We're on Xcode 15.3/15.4. There is discussion on the Swift Forums of potentially related problems: https://forums.swift.org/t/xcode-automatically-updating-package-resolved/41900
5
0
971
Aug ’24
The DateFormatter is returning wrong date format 2024-04-23T7:52:49.352 AMZ, 2024-05-23T11:16:24.706 a.m.Z
import Foundation let formatter = DateFormatter() let displayLocalFormat = true or false let timeZone = UTC let dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" let currentDate = Date() formatter.locale = displayLocalFormat ? Locale.current : Locale(identifier: "en_US_POSIX") formatter.dateFormat = dateFormat formatter.timeZone = timeZone formatter.string(from: date) // This function returns date format 2024-05-23T11:16:24.706 a.m.Z
6
0
623
Jun ’24
DocC not finding local sources files
Context Hello everyone, I'm a freshly graduate engineer currently learning Swift and Apple ecosystem frameworks as I wish to become an Apple Developer / Engineer. I made a very simple and light Swift package but I cannot build the documentation using DocC. Issue See my project here on github and explanations below. Behavior Building Documentation for my Swift package results in an empty page with only my Package name. Adding a documentation catalog with a start page work but only the start page is displayed after building. None of my structs in any sources files appears in the built documentation. Trying to add symbol linking to my sources files's structs in the start page (using double backquotes) results in the Topic section not built and a warning "MyStruct doesn't exist at '/MyPackage'" What I tried I found multiple information while looking for a solution, so I tried everything. None of my structs / classes have the same name as the package I did not remove the Topics section in the start page of the documentation catalog, neither I removed the Header 2 formatting. My documentation catalog and my sources files lies within MyPackage/Sources/MyPackage/ I compared my starting page and folder architecture with the Sloth demo project I did comment my structs / classes / functions with three slash /// using Xcode shortcut to pre-write documentation Technical Specifications macOS 14.5 MacBook Pro M3 Pro 18Go Xcode Version 15.4 (15F31d) swift-tools-version: 5.10 Images Conclusion I have no idea what else to do and if I am doing something wrong. Any feedback or solution on my issue would be really appreciated as I'm doing my best to learn the best practices to become an Apple developer. Thank you.
1
0
629
Jun ’24
Errors building with manual provisioning profile and packages with PrivacyInfo
Errors building with manual provisioning profile and packages with PrivacyInfo.xcprivacy added. When I look at the changes in the package, the only difference is adding this .xcprivacy file. The error looks like this: PLCrashReporter_CrashReporter does not support provisioning profiles, but provisioning profile *** has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. Using an Enterprise certificate with manually created provisioning profile, I don't have the option to choose automatic. And I can't change build settings for the swift packages. Does anyone know how I can work around this issue?
3
0
666
Jun ’24
SPM Resolution Challenges
I've been relying on SPM to manage some packages related to a project I'm working on, and while it mostly worked well when the dependencies were small, it has become increasingly difficult to make updates to package versions and have Xcode use those updates (now around 20 total depencies). For example, suppose I have this working state: Package A (private in Github) -> tag 1.2.2 Xcode SPM 'Up to Next Major Version" -> 1.00 < 2.00 Now, I want to update package A to be a new version (e.g. 1.3.0). I update the package, give it a new tag and push the tags to git. Now, if I open my project without performing any action, the package version will almost always not update. Things I can do: 'Update Package' from the Package Dependency list. (Has no effect) 'Update to latest package versions' from the Package Dependency header. (Has no effect) Resolve package versions / Reset package caches (Has no effect) What used to work in the past was to remove the dependency in Xcode, and re-add it. 90% of the time, it wouldn't add on first try, so I would have to try to add it, cancel out of the dialog once, and try again. That used to work. Now, a new package version won't add at all. I just get the 'Unable to resolve dependencies' dialog. 'Add anyway' leaves my project in an unusable state. I'm now in a position where I have to close, clean, restart, reset caches, etc for long stretches of time until with some stroke of luck the versions update correctly and the project will build. This is hugely disruptive to my development flow and am hoping to find a reliable solution that doesn't take 30+ minutes of rebuilding and retrying before the project is in a usable state with my updated package.
0
0
285
May ’24