Post

Replies

Boosts

Views

Activity

Reply to iOS 26 (beta 7) setting .searchFocused programmatically does not work
Tested again in iOS 26 and Xcode RC and this is still an issue I also noticed that if the search bar is placed below the navigation bar, the keyboard will appear as expected, but obviously I'd want the new preferred default (bottom bar) placement to also display the keyboard I also tried making a simple TextField in the bottomBar, and set its default focus, which did cause the keyboard to appear So this issue appears to be constrained to only the situation where it's a real search bar, and it's placed in the bottomBar area.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’25
Reply to LiveActivities preview in XCode, Missing 'previewContext'
Is it possible there are issues with previewing Live Activities in Xcode 16.2? I believe I have everything set up correctly, and the project builds properly with no errors, but the preview canvas is always blank struct RestTimerLiveActivity: Widget { var body: some WidgetConfiguration { if #available(iOS 18.0, *) { return ActivityConfiguration(for: RestTimerActivityAttributes.self) { context in RestTimerActivityContent(context: context) } dynamicIsland: { context in dynamicIslandContent(context: context) } .supplementalActivityFamilies([.small]) } else { return ActivityConfiguration(for: RestTimerActivityAttributes.self) { context in RestTimerMediumView(context: context) } dynamicIsland: { context in dynamicIslandContent(context: context) } } } private func dynamicIslandContent(context: ActivityViewContext<RestTimerActivityAttributes>) -> DynamicIsland { DynamicIsland { DynamicIslandExpandedRegion(.leading) { Text("Hello") } DynamicIslandExpandedRegion(.trailing) { Text("0:15") } DynamicIslandExpandedRegion(.center) { Text("Timer") } DynamicIslandExpandedRegion(.bottom) { Text("Rest Timer") } } compactLeading: { Text("Hello") } compactTrailing: { Text("0:15") } minimal: { Text("Hello") } } } @available(iOS 18.0, *) struct RestTimerActivityContent: View { @Environment(\.activityFamily) var activityFamily var context: ActivityViewContext<RestTimerActivityAttributes> var body: some View { switch activityFamily { case .medium: RestTimerMediumView(context: context) case .small: RestTimerSmallView(context: context) @unknown default: fatalError() } } } struct RestTimerMediumView: View { var context: ActivityViewContext<RestTimerActivityAttributes> var body: some View { Text("Medium!") } } struct RestTimerSmallView: View { var context: ActivityViewContext<RestTimerActivityAttributes> var body: some View { Text("Small!") } } #Preview("Live Activity Content", as: .content, using: RestTimerActivityAttributes.middle) { RestTimerLiveActivity() } contentStates: { RestTimerActivityAttributes.ContentState.idle RestTimerActivityAttributes.ContentState.paused RestTimerActivityAttributes.ContentState.running } #Preview("Live Activity Dynamic Island Compact", as: .dynamicIsland(.compact), using: RestTimerActivityAttributes.middle) { RestTimerLiveActivity() } contentStates: { RestTimerActivityAttributes.ContentState.idle RestTimerActivityAttributes.ContentState.paused RestTimerActivityAttributes.ContentState.running }
Dec ’24