Hi everyone,
I’m building an iOS app that originally targeted iPhone using NavigationStack. Now I’m adapting it for iPad and switched to using NavigationSplitView to support a three-column layout.
The structure looks like this:
NavigationSplitView {
A // Sidebar
} content: {
B // Middle column – this shows a list
} detail: {
C // Detail view
}
The issue is with the list shown in view B (the content column). It appears completely unstyled, as if it’s using .listStyle(.plain) — with no background material, and a very flat look.
I can understand that this might be intentional on iPad to visually distinguish the three columns.
However, the problem is that this same unstyled list also appears on iPhone, even though iPhone only shows a single column view at a time!
I tried explicitly setting .listStyle(.insetGrouped) or .listStyle(.grouped) on the list in view B, but it makes no difference.
When I go back to NavigationStack, the list in B is styled properly, just as expected — but then I lose the enhanced iPad layout.
What I’m looking for:
I’d like to keep using NavigationSplitView, but I want the list in the content column (view B) to use the default iOS list styling, at least on iPhone.
Is there any way to achieve this?
Thanks!
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi everyone,
I’m building an iOS app that originally targeted iPhone using NavigationStack. Now I’m adapting it for iPad and switched to using NavigationSplitView to support a three-column layout.
The structure looks like this:
NavigationSplitView {
A // Sidebar
} content: {
B // Middle column – this shows a list
} detail: {
C // Detail view
}
The issue is with the list shown in view B (the content column). It appears completely unstyled, as if it’s using .listStyle(.plain) — with no background material, no grouped sections, and a very flat look.
I can understand that this might be intentional on iPad to visually distinguish the three columns.
However, the problem is that this same unstyled list also appears on iPhone, even though iPhone only shows a single column view at a time!
I tried explicitly setting .listStyle(.insetGrouped) or .listStyle(.grouped) on the list in view B, but it makes no difference.
When I go back to NavigationStack, the list in B is styled properly, just as expected — but then I lose the enhanced iPad layout.
What I’m looking for:
I’d like to keep using NavigationSplitView, but I want the list in the content column (view B) to use the default iOS list styling, at least on iPhone.
Is there any way to achieve this?
Thanks!
Hi, I’m using SwiftData with an @Observable DatabaseManager class that is shared between my app and a widget. This class is located inside a Swift package and looks roughly like this:
public final class DatabaseManager {
public static let shared = DatabaseManager()
private init() {
let groupID = "group.com.yourcompany.myApp"
let config = ModelConfiguration(groupContainer: .identifier(groupID))
let c = try! ModelContainer(for: MyModel.self, configurations: config)
self.container = c
self.modelContext = c.mainContext
}
public private(set) var container: ModelContainer
public private(set) var modelContext: ModelContext
}
In the main app, I inject the container and context like this:
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.modelContainer(DatabaseManager.shared.container)
.modelContext(DatabaseManager.shared.modelContext)
}
}
}
Both the widget and the main app import the same package, and both use DatabaseManager.shared for reading and writing objects.
The problem:
When the widget updates an object using an AppIntent, the change is not reflected in the main app unless I fully terminate and relaunch it. If I just bring the app back to the foreground, it still shows stale data.
Is there a recommended way to make the main app observe or reload SwiftData changes that were made in the widget (via the same shared app group and container)? I’m already using .modelContainer(...) and .modelContext(...) in the app, and everything else works fine — it’s just the syncing that doesn’t happen unless I force-relaunch the app.
Thanks!