Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andylindebros/resizableview
Provides a resizable SwiftUI view for MacOS
https://github.com/andylindebros/resizableview
macos resizableview swiftui
Last synced: about 2 months ago
JSON representation
Provides a resizable SwiftUI view for MacOS
- Host: GitHub
- URL: https://github.com/andylindebros/resizableview
- Owner: andylindebros
- License: mit
- Created: 2024-08-27T14:06:25.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-27T14:20:07.000Z (4 months ago)
- Last Synced: 2024-10-11T22:42:45.568Z (2 months ago)
- Topics: macos, resizableview, swiftui
- Language: Swift
- Homepage:
- Size: 503 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ResizableView
This Swift package offers a SwiftUI view designed for resizing, making it ideal for managing window panes in macOS applications.![ResizableView](ResizableView.gif)
## Installation:
Add the package and desired version to your project:
```
https://github.com/andylindebros/ResizableView
```## Implementation
``` Swift
ResizableView(size: Binding, side: .trailing) {
Your content
}
```Available resizable sides:
``` Swift
enum Side {
case leading, trailing, top, bottom
}
```Example:
``` Swift
struct ContentView: View {
@State var leftPaneWidth: CGFloat = 100
@State var rightPaneWidth: CGFloat = 100
@State var topPaneHeight: CGFloat = 100
@State var bottomPaneHeight: CGFloat = 100
var body: some View {
HStack(spacing: 0) {
ResizableView(size: $leftPaneWidth, side: .trailing) {
VStack {
Text("Left")
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.red)
}
VStack(spacing: 0) {
ResizableView(size: $topPaneHeight, side: .bottom) {
VStack {
Text("Top")
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.blue)
}VStack {
Text("Content")
.foregroundStyle(.white)
}.frame(maxWidth: .infinity, maxHeight: .infinity)ResizableView(size: $bottomPaneHeight, side: .top) {
VStack {
Text("Bottom")
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.green)
}
}
ResizableView(size: $rightPaneWidth, side: .leading) {
VStack {
Text("Right")
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.yellow)
}
}
.foregroundStyle(.black)
}
}
```