Posts

Post not yet marked as solved
1 Replies
823 Views
If I have a horizontal scrollview with a lazy hstack inside and I test it with a right-to-left language (e.g. arabic), the lazy hstack loads the elements wrong. This means, that the elements that should become visible are disappearing and the other way round. Applying the .flipsForRightToLeftLayoutDirection(true) modifier makes the lazy stack loads the elements correctly, but then the elements are flipped horizontally. Does anyone know how to fix this issue? Tested with Xcode 12.0 / 12.2 beta and iOS 14.0 / 14.2 beta
Posted
by mw_906.
Last updated
.
Post marked as solved
4 Replies
2.5k Views
I noticed an issue with the drag and drop features in SwiftUI that are available since iOS 13.4. The drag and drop operation with the .onDrag and .onDrop modifiers works fine in the simulator, but on a real device (iPhone and iPad) you just see a transparent rect, instead of the view while dragging the view. Does anyone have a solution to get the correct preview image while the view is dragged? struct MainView: View { @State var isDropTarget = false var body: some View { 				VStack{ 						Image(systemName: "doc.text") 								.font(.system(size: 40)) 								.frame(width: 150, height: 150) 								.onDrag {	 return NSItemProvider(object: "TestString" as NSString) } 						 						Color.orange 								.opacity(isDropTarget ? 0.5 : 1) 								.onDrop(of: ["public.text"], isTargeted: $isDropTarget) { items in 										for item in items { 												if item.canLoadObject(ofClass: NSString.self) { 														item.loadObject(ofClass: String.self) { str, _ in 																print(str ?? "nil") 														} 												} 										} 										return true 						} 				} }
Posted
by mw_906.
Last updated
.