I’ve a easy UISplitViewController structure of at all times seen major and secondary columns.
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, choices connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
// Create a UISplitViewController
let splitViewController = UISplitViewController(type: .doubleColumn)
splitViewController.preferredDisplayMode = .oneBesideSecondary
splitViewController.presentsWithGesture = false
// Arrange major and secondary view controllers
let primaryVC = UIViewController()
primaryVC.view.backgroundColor = .systemBlue
let secondaryVC = UIViewController()
secondaryVC.view.backgroundColor = .systemGreen
// Assign them to the break up view controller
splitViewController.setViewController(primaryVC, for: .major)
splitViewController.setViewController(secondaryVC, for: .secondary)
// Set most popular width and min/max column width
splitViewController.preferredPrimaryColumnWidth = 80
splitViewController.minimumPrimaryColumnWidth = 80
splitViewController.maximumPrimaryColumnWidth = 80
// Initialize the window
window = UIWindow(windowScene: windowScene)
window?.rootViewController = splitViewController
window?.makeKeyAndVisible()
}
It labored succesfully like that for my app for a while. Nonetheless, I’ve seen some layouting points on iOS18 and began to dig a bit deeper. It seems that one thing modified in UISplitViewController’s construction between releases.
I am operating the follwing debuger command:
po splitViewController?.view.subviews.first?.subviews
On iPadOS 18:
; layer = >
; layer = >
>
On iPadOS 17.5:
; layer = >
; layer = >
; layer = >
In each circumstances we’ve 2 tab containers and a divider. Nonetheless, on iOS 18 it seems that the divider is positioned not by facet however moderately above the container view.
When attaching a view to the view.leadingAnchor
or view.safeAreaLayoutGuide.leadingAnchor
of secondary view controller
on iPadOS 18 it goes behind the divider:
on iPadOS 17 it goes subsequent to the divider:
Now, my query is, assuming that is not an Apple bug – is there technique to get this 0.5px dimension of the divider in any elegant method? It would not appear to be mirrored by protected space values or something comparable.