Skip to content

Instantly share code, notes, and snippets.

@haikusw
Forked from chockenberry/TestApp.swift
Created December 21, 2024 03:31
Show Gist options
  • Save haikusw/97497874d97ccc1faffca96f654c0ff2 to your computer and use it in GitHub Desktop.
Save haikusw/97497874d97ccc1faffca96f654c0ff2 to your computer and use it in GitHub Desktop.
Swipe actions breaking ShareLink()
//
// TestApp.swift
// TestApp
//
// Created by Craig Hockenberry on 12/19/24.
//
import SwiftUI
@main
struct TestApp: App {
var body: some Scene {
WindowGroup {
WTFView()
}
}
}
struct WTFView: View {
@State private var WTF = false
var body: some View {
Button("WTF!") {
WTF.toggle()
}
.sheet(isPresented: $WTF) {
// Tapping on the share icon produces something like this in the console:
// Attempt to present <UIActivityViewController: ..> on
// <_SwiftUI-UIHostingController-ModifiedContent-AnyView-RootModifier__: ..>
// (from <_SwiftUI-UIHostingController-ModifiedContent-AnyView-RootModifier__: ..>)
// which is already presenting <_SwiftUI-PresentationHostingController-AnyView_: ..>.
ShareLink(item: URL(string: "https://iconfactory.com")!) {
Label("Share", systemImage: "square.and.arrow.up")
.labelStyle(.iconOnly)
}
}
#if true // turn this off and ShareLink works fine
.swipeActions(edge: .leading) {
Button("OH RLY?") {
print("really.")
}
}
#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment