Skip to content

Commit

Permalink
Add macOS gif to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
eonist committed Oct 26, 2024
1 parent 2284bd5 commit cec81d7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
8 changes: 4 additions & 4 deletions ExampleProject/ExampleProject/ExampleProjectApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ struct ExampleProjectApp: App { // App Protocol: Conforms to the App protocol wh
WindowGroup { // WindowGroup: A scene type used for apps that manage one or more windows on a platform.
ExampleView()
.background(Color.blackOrWhite.opacity(1))
.environment(\.colorScheme, .dark) // dark
#if os(iOS) // Not available on macOS
.statusBar(hidden: true) // Hide the status bar (looks better for demos)
#if os(iOS)
// .environment(\.colorScheme, .dark) // dark
.statusBar(hidden: true) // Hide the status bar (looks better for demos) (Not available on macOS)
#endif
// .persistentSystemOverlays(.hidden) // Hide the Home Indicator (looks better for demos)
}
Expand All @@ -32,4 +32,4 @@ struct ExampleProjectApp: App { // App Protocol: Conforms to the App protocol wh
* developers to visually identify different areas of the
* interface by applying distinct background colors.
*/
internal var isTest: Bool = true
internal var isTest: Bool = false
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import HybridColor
*/
#Preview(traits: .fixedLayout(width: 800, height: 500)) {
ExampleView()
.background(Color.blackOrWhite.opacity(1))
.environment(\.colorScheme, .dark) // dark
#if os(iOS) // Not available on macOS
.statusBar(hidden: true) // Hide the status bar (looks better for demos)
#if os(iOS)
.background(Color.blackOrWhite.opacity(1))
.statusBar(hidden: true) // Hide the status bar (looks better for demos) (Not available on macOS)
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ extension MainView {
splitConfig: splitConfig, // Configuration for the split view behavior in the main view.
sizeClass: $sizeClass // A binding to the size class, used to adapt the UI for different device sizes.
)
#if os(iOS)
.background(isTest ? .pink.opacity(0.5) : .whiteOrBlack.opacity(0.07)) // ⚠️️ debug
#else
.background(isTest ? .pink.opacity(0.5) : .whiteOrBlack.opacity(0.07)) // ⚠️️ debug
#endif
}
/**
* vStack
Expand All @@ -44,7 +48,11 @@ extension MainView {
mainList
Spacer() // Pins the stack to the top
}
#if os(iOS)
.background(isTest ? .blue.opacity(0.3) : .whiteOrBlack.opacity(0.07)) // ⚠️️ debug
#else
.background(isTest ? .blue.opacity(0.3) : .whiteOrBlack.opacity(0.07)) // ⚠️️ debug
#endif
}
/**
* mainList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ extension SideBarView {
sideBarHeader // Displays the sidebar header with title, size class, and split configuration.
list // Displays the list of sidebar items, allowing selection handling.
}
#if os(iOS)
.background(isTest ? .teal.opacity(0.3) : .whiteOrBlack.opacity(0.1)) // ⚠️️ debug - has effect only if we add .scrollContentBackground(.hidden)
#else
.background(isTest ? .teal.opacity(0.3) : .blackOrWhite.opacity(0.1)) // ⚠️️ debug - has effect only if we add .scrollContentBackground(.hidden)
#endif
}
/**
* Header
Expand All @@ -50,7 +54,11 @@ extension SideBarView {
sizeClass: $sizeClass, // The size class that adjusts the sidebar's layout based on the available space.
splitConfig: splitConfig // Configuration details for the split view behavior in the sidebar.
)
#if os(iOS)
.background(isTest ? .green.opacity(0.5) : .whiteOrBlack.opacity(0.1)) // ⚠️️ debug
#else
.background(isTest ? .green.opacity(0.5) : .whiteOrBlack.opacity(0.05)) // ⚠️️ debug
#endif
}
/**
* - Description: The list of items in the sidebar.
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,13 @@ These are some of the resources that was founds when solving edge cases for the
- SwiftUI SplitView Compact Column Control [https://useyourloaf.com/blog/swiftui-splitview-compact-column-control/](https://useyourloaf.com/blog/swiftui-splitview-compact-column-control/)
- SwiftUI on iPad: Organize your interface: [https://developer.apple.com/videos/play/wwdc2022/10058/https://developer.apple.com/videos/play/wwdc2022/10058/](https://developer.apple.com/videos/play/wwdc2022/10058/https://developer.apple.com/videos/play/wwdc2022/10058/)


## macOS:
<img width="401" alt="img" src="https://s11.gifyu.com/images/SO8Yn.gif">

## Todo:

- Move the debug view a bit up from the bottom of the app for macOS
- Use darker transperancy background for sidebar for macOS

## Future improvements:

Expand Down

0 comments on commit cec81d7

Please sign in to comment.