Skip to content

Commit

Permalink
Add support for macOS for isShowingSideBar
Browse files Browse the repository at this point in the history
  • Loading branch information
eonist committed Oct 26, 2024
1 parent 1c24a1f commit 5be64ca
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Sources/SplitViewKit/util/SplitConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,25 @@ extension SplitConfig {
/**
* - Description: Determines if the sidebar is currently visible based on
* the column visibility and size class.
* - Note: `UserInterfaceSizeClass` does not work for macOS
* - Note: On mac `preferredCompactColumn` isn't relevant
* - Fixme: ⚠️️ Document in which scenario this is used etc
* - Fixme: ⚠️️ This is also true if 1 col + preferredCompactColumn == .sidebar I think
* - Parameter sizeClass: The current horizontal size class of the user interface, which determines the layout and visibility of the sidebar.
* - Returns: A Boolean value indicating whether the sidebar is visible based on the current `columnVisibility` and `sizeClass`.
*/
public func isShowingSideBar(sizeClass: UserInterfaceSizeClass?) -> Bool {
let isShowingSideBar = (columnVisibility == .all && sizeClass == .regular) || (preferredCompactColumn == .sidebar && sizeClass == .compact)
return isShowingSideBar
#if os(iOS)
(columnVisibility == .all && sizeClass == .regular) || (preferredCompactColumn == .sidebar && sizeClass == .compact)
#else // macOS
columnVisibility == .all
#endif
}
/**
* - Description: A computed property that checks if the detail view is in full screen mode.
* It returns true if the column visibility is set to .detailOnly, indicating that
* only the detail view is visible and hence, is in full screen mode.
* - Fixme: ⚠️️ Add note regarding if this is relevant for macOS
*/
public var isDetailFullScreen: Bool {
columnVisibility == .detailOnly
Expand Down

0 comments on commit 5be64ca

Please sign in to comment.