Posts

Post not yet marked as solved
0 Replies
237 Views
I've noticed some issues in the iOS simulator when reordering elements in a List while the view is in edit mode. The rows will sometimes disappear or repeat. I have verified that the data source is updating after the move but the rows themselves will render strangely, like some rows will be repeated or just disappear entirely. It also doesn't seem to happen on a physical device, just the simulator. Here is a reproducible example view: struct ContentView: View { @State var arr = ["Dan", "Jeffery", "Alice", "Jessica", "Mary"] var body: some View { NavigationView { List { ForEach(arr, id: \.self) { user in Text(user) } .onMove(perform: { from, to in arr.move(fromOffsets: from, toOffset: to) }) } .toolbar { ToolbarItem(placement: .navigationBarTrailing) { EditButton() } } .navigationBarTitleDisplayMode(.inline) } .stackNavigationView() } }
Posted
by artclark.
Last updated
.
Post not yet marked as solved
1 Replies
786 Views
Hello all, we have ran into a problem building our test target that only occurs in Xcode 15. Our team has an SPM package that we use for shared code across our apps. This SPM package also has a dynamically linked target that contains utilities for testing. Within our app we link this test utilities library via Build Phases -> Link Binary with Libraries. On Xcode < 15 we have no problem resolving this library within our test target but on 15 we get a linking error if we try and and link it in the same way. If we remove this library from Build Phases -> Link Binary with Libraries then the linking error goes away, though of course then we will get errors as this library is still used within the XCTests of our test target. This is a simplified snippet of what our Package.swift looks like for our Swift Package let package = Package( name: "Library", platforms: [ .iOS(.v15) ], products: [ .library( name: "Library", targets: ["Library"] ), .library( name: "LibraryTestUtilities", type: .dynamic, targets: ["LibraryTestUtilities"] ) ], dependencies: [ // Dependencies declare other packages that this package depends on. ], targets: [ .target( name: "Library", dependencies: [ // Dependencies ]) , .target( name: "LibraryTestUtilities", dependencies: [ "Library" ]), .testTarget( name: "LibraryTests", dependencies: ["Library", "LibraryTestUtilities"]), ] ) I have tried to use the linker flags -ld_classic and -ld64 to no avail and I'm not sure where to go from here. It's not exactly obvious what linking change in Xcode 15 is resulting in the failure to resolve this library. We would appreciate any help on this matter, thanks!
Posted
by artclark.
Last updated
.
Post not yet marked as solved
3 Replies
1.6k Views
Does anyone know if there is a way to disable background taps while a Menu is active? Currently the only way to dismiss a Menu is to tap away but if one taps something tappable, like a button or nav link the Menu is dismissed and the tap is registered. This is isn't the biggest deal in the world, however I have noticed an issue when the button tap opens a sheet. If the sheet opening tap is pressed while the menu is open, the sheet will not open and the following error is printed in the console. Attempt to present <TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView: 0x7ff2ff22e000> on <TtGC7SwiftUI19UIHostingControllerV7Topline13MenuSheetTest: 0x7ff2fdf23b90> (from <TtGC7SwiftUI19UIHostingControllerV7Topline13MenuSheetTest: 0x7ff2fdf23b90>) which is already presenting <_UIContextMenuActionsOnlyViewController: 0x7ff2ff22d690>. I have the following sample snippet that will demonstrate this behavior: @State var sheetOpen = false       var body: some View {     HStack {       Button {         sheetOpen.toggle()       } label: {         Text("Open Sheet")       }       Spacer()       Menu("Open menu") {         Button {           print("Option 1 pressed")         } label: {           Text("Option 1")         }                  Button {           print("Option 2 pressed")         } label: {           Text("Option 2")         }       }     }     .padding()     .sheet(isPresented: $sheetOpen) {       Text("Sheet is open")     }   } Has anyone else encountered this behavior before? If I could disable taps while the Menu is open I could avoid this "already presenting" error entirely. I have also looked at setting up a proxy variable for when the Menu is open or not but there doesn't seem like a universal solution that would work in all cases. Any help would be appreciated, thanks!
Posted
by artclark.
Last updated
.
Post marked as solved
3 Replies
1.5k Views
I'm having an issue resolving some dependencies in the test suite for my app when using a Swift Package in my test target. Here's the setup: We have a Swift Package that contains two products. One product is the main library that is used throughout our app. The other product is a library of testing utilities, like mocks and such. This is a simplified version of its Package.Swift file with actual package/target/library/dependency names changed. let package = Package(   name: "Library",   platforms: [     .iOS(.v14)   ],   products: [     // Products define the executables and libraries a package produces, and make them visible to other packages.     .library(       name: "Library",       targets: ["Library"]),     .library(       name: "LibraryTestUtilities",       targets: ["LibraryTestUtilities"]     ),   ],   dependencies: [     // Dependencies declare other packages that this package depends on.     // .package(url: /* package url */, from: "1.0.0"),     .package(url: <DependencyA URL>, .upToNextMajor(from: "1.0.0")),     .package(url: <DependencyB URL>,.upToNextMajor(from: "1.0.0"))   ],   targets: [     // Targets are the basic building blocks of a package. A target can define a module or a test suite.     // Targets can depend on other targets in this package, and on products in packages this package depends on.     .target(       name: "Library",       dependencies: [         .product(name: "DependencyA", package: "DependencyA"),         .product(name: "DependencyB", package: "DependencyB")       ])     ,     .target(       name: "LibraryTestUtilities",       dependencies: [         .target(name: "Library")       ]     ),     .testTarget(       name: "LibraryTests",       dependencies: ["Library", "LibraryTestUtilities"]),   ] ) In our App, our target is linked to the "Library" product. Our test target is linked to "LibraryTestUtilities". When we try to build the test target, we're getting build errors in the form No Such Module DependencyA when compiling the "Library" product. Swift Package Manager is not able to link the dependencies from "Library" even though "LibraryTestUtiltities" is dependent on "Library". There are also no such issues resolving the "Library" dependencies when building the main app target or when building/testing the "Library" package directly. We are only having issues when trying to link the "LibraryTestUtilities" target to our app's test target through Build Phases -> Link Binary With Libraries. I couldn't find any similar issues encountered online so perhaps our setup is misguided, though there doesn't seem to be any obvious reason why it wouldn't work. We would appreciate any help, thanks!
Posted
by artclark.
Last updated
.
Post not yet marked as solved
0 Replies
1k Views
My team uses a script for generating and parsing code coverage for an Xcode project locally which utilizes the CI command xcodebuild. Ever since updating to Xcode 14 we have been unable to successfully resolve the package graph to build the project. I have noticed that this will only happen when the -derivedDataPath flag is set, however we use that to easily fetch the coverage file generated when running xcodebuild. The error we are seeing is this: an out-of-date resolved file was detected at .../Package.resolved, which is not allowed when automatic dependency resolution is disabled; please make sure to update the file to reflect the changes in dependencies. Running resolver because the following dependencies were added: The list of dependencies that xcodebuild claims are "added" changes after every run. I have no problem resolving the dependencies while using Xcode, or if I simply forgo using a custom build path with -derivedDataPath. The xcodebuild command is as follows: xcodebuild -project {Our xcodeproj file path } -scheme {Our scheme} -destination "platform=iOS Simulator,name=iPad Pro (11-inch) (3rd generation)" -derivedDataPath Build/ -disableAutomaticPackageResolution -skipPackageUpdates -onlyUsePackageVersionsFromResolvedFile -scmProvider xcode -enableCodeCoverage YES clean build test Any ideas why we might be seeing this behavior? Like I said, this script was functioning prior to Xcode 14 so there must be something in the update that is responsible so any help would be appreciated! Thanks!
Posted
by artclark.
Last updated
.