Post

Replies

Boosts

Views

Activity

.presentationBackground ViewModifier doesn’t render correctly when used with new zoom transitions API
In SwiftUI, when using the .presentationBackground modifier in combination with the new zoom transitions API, the background does not interpolate or render correctly during or after the transition. This issue is observed when using .fullScreenCover and .sheet with .presentationBackground modifier set for the presenting content. In the case of using sheet, the modifier does not work at all, and in the case of using .fullScreenCover, the modifier does render the background correctly, but only after a delay. Sample code: struct Icon: Identifiable { var id: String var color: Color } struct ContentView: View { let icons = [ Icon(id: "figure.badminton", color: .red), Icon(id: "figure.fencing", color: .orange), Icon(id: "figure.gymnastics", color: .green), Icon(id: "figure.indoor.cycle", color: .blue), Icon(id: "figure.outdoor.cycle", color: .purple), Icon(id: "figure.rower", color: .indigo), ] @Namespace var animation @State private var selected: Icon? var body: some View { LazyVGrid(columns: [.init(.adaptive(minimum: 100, maximum: 300))]) { ForEach(icons) { icon in Button { selected = icon } label: { Image(systemName: icon.id) } .foregroundStyle(icon.color.gradient) .font(.system(size: 100)) .matchedTransitionSource(id: icon.id, in: animation) { source in return source.background(Color.clear) } } } .fullScreenCover(item: $selected, content: { icon in DestinationView(icon: icon, animation: animation) .presentationBackground(.thinMaterial) }) // .sheet(item: $selected) { icon in // DestinationView(icon: icon, animation: animation) // .presentationBackground(.ultraThinMaterial) // } } } struct DestinationView: View { var icon: Icon var animation: Namespace.ID var body: some View { Image(systemName: icon.id) .font(.system(size: 300)) .foregroundStyle(icon.color.gradient) .navigationTransition(.zoom(sourceID: icon.id, in: animation)) } } #Preview { ContentView() } I have filed a feedback regarding this issue: FB14929113 but if there are any workarounds out there at the moment, I'd love to know. Thanks!
0
1
276
Aug ’24
ControlConfigurationIntent won't open the app despite setting openAppWhenRun = true
I am working on building Control widgets for our app and have noticed that openAppWhenRun doesn't seem to work for any ControlConfigurationIntent. When attaching the debugger to the widget extension in a sample project, I see the following error: Unknown NSError The operation couldn’t be completed. (LNActionExecutorErrorDomain error 2018.) This is reproducible as of Xcode 16.0 Beta 2 and Beta 3. I have noted that using an OpenIntent, with a parameter called target that conforms to AppEnum seems to open the app properly, but if I use that workaround, adding any additional parameters to the OpenIntent seems to break things again. Are others seeing this issue? I have feedback FB14357691. Here's some sample code below to reproduce: var body: some ControlWidgetConfiguration { AppIntentControlConfiguration(kind: "Open Any Screen", intent: OpenAppScreenIntent.self) { template in ControlWidgetButton(action: template) { Label { Text("Open App") } icon: { Image(systemName: "calendar") } }.tint(.red) } } } enum AppScreen: CaseIterable { case calendar case campus case search var title: String { switch self { case .calendar: "Calendar" case .campus: "Campus" case .search: "Search" } } } struct OpenAppScreenIntent: ControlConfigurationIntent { static var title: LocalizedStringResource = "Open app to a screen" static var description = IntentDescription("Opens the app.") /// The app should open regardless of what happens here static let openAppWhenRun: Bool = true @Parameter(title: "Screen", optionsProvider: OsuScreenOptionsProvider()) var screen: String? struct OsuScreenOptionsProvider: DynamicOptionsProvider { func results() async throws -> ItemCollection<String> { var screenTitles: [String] = [] for screen in AppScreen.allCases { async let title = screen.title await screenTitles.append(title) } return ItemCollection { ItemSection(items: screenTitles.map { IntentItem($0)}) } } func defaultResult() async -> String? { return "Campus" } } @MainActor func perform() async throws -> some IntentResult { #warning("The app should open regardless of what happens in this method, but it doesn't") return .result() } }
6
0
1.6k
Jul ’24
Is there any way to expose an AppIntent that lives in the app package or an AppIntentExtension to a widget?
I have AppIntent code which lives in my app package that can not easily be decoupled and migrated into its own standalone framework or extension. This is because this intent has some action that relies on my app's network and core data stack. I'd like to expose this existing intent in some way to a Button in a widget, but so far I have not had success. Is this currently possible with AppIntentPackage or some other means? Is there a way I can use AppIntents to pass a message back to the app? How should I approach this? Thank you!
6
5
3.4k
Jun ’23
Crash at runtime due to missing symbol in Xcode 14+ for NSCoreDataCoreSpotlightDelegate.indexDidUpdateNotification (FB11498873)
We are currently experiencing a crash at runtime reproducible in Xcode 14.0 onward due to a dyld missing symbol for NSCoreDataCoreSpotlightDelegate.indexDidUpdateNotification which occurs on devices that are running iOS 15.x. I have discovered using NSNotification.Name.NSCoreDataCoreSpotlightDelegateIndexDidUpdate instead seems to workaround this issue and will allow the previously working notification behavior to continue working. Wanted to share this for others that might've run into the same issue. Hopefully an upcoming Xcode release can remedy this. If an Xcode engineer could take a look at this it would be much appreciated!
0
0
1.1k
Sep ’22
How has GeometryReader's behavior changed between iOS 13 and iOS 14?
Hi there, We have a spot in our app where we use a GeometryReader to create a circle as a background view on a Text view. It seems as though GeometryReader's behavior has changed between iOS 13 and iOS 14. On iOS 13, the background circle is centered by default; on iOS 14 it is not. My question is: how exactly has GeometryReader's behavior changed between iOS 13 and iOS 14, and can the docs be updated to reflect these changes? Here's the sample code to reproduce: struct ContentView: View {   var body: some View {     Text("Test")       .foregroundColor(Color.white)       .background(         GeometryReader { geometry in           Circle()             .frame(width: max(geometry.size.width, geometry.size.height) + 10, height: max(geometry.size.width, geometry.size.height) + 10)             .foregroundColor(.red)         }       )   } } On iOS 14, adding the following viewmodifer to the Circle adjusts the behavior to be the same as iOS 13 .position(x: geometry.size.width / 2, y: geometry.size.height / 2)
5
0
4.1k
Jul ’20