Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/krusty84/goodpropertabs
The GoodProperTabs is a package to simplify the creation of tabs in a SwiftUI application for macOS.
https://github.com/krusty84/goodpropertabs
macos swift swiftui tabs tabs-management xcode
Last synced: about 1 month ago
JSON representation
The GoodProperTabs is a package to simplify the creation of tabs in a SwiftUI application for macOS.
- Host: GitHub
- URL: https://github.com/krusty84/goodpropertabs
- Owner: Krusty84
- License: gpl-3.0
- Created: 2024-12-17T19:58:36.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-12-20T19:50:28.000Z (about 1 month ago)
- Last Synced: 2024-12-20T20:28:08.319Z (about 1 month ago)
- Topics: macos, swift, swiftui, tabs, tabs-management, xcode
- Language: Swift
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
The **GoodProperTabs** is a package to simplify the creation of tabs in a SwiftUI application for macOS.
This package was created 99.99% thanks to **Jerome** and his excellent example:
https://github.com/jmuzet/myCustomTabView
It demonstrates a classic approach to placing tabs in an application window.**Your tabs will looks like:**
![image](https://github.com/user-attachments/assets/c1e4a8ad-e6c6-4542-a569-9c14d0523122)
**How to use:**
1.Add this repo (https://github.com/Krusty84/GoodProperTabs.git) as Package at your project, in Xcode Menu: File->Add Package Dependencies...
![image](https://github.com/user-attachments/assets/7ef2ecfe-ed8e-40ca-8859-bf10ac29d041)
2.Add Package at you code
```
import SwiftUI
import GoodProperTabs
struct ContentView: View {
var body: some View {
GoodProperTabsView(content: [
//OOTB icon from SF, system:sf_icon_name
(title: "Tab 1", icon: "system:apple.logo", view: AnyView(CustomTabContent())),
//CUSTOM icon from Assets.xcassets
(title: "Tab 2", icon: "iconFromAssets.xcassets", view: AnyView(Text("Tab #01"))),
//OOTB icon from SF, system:sf_icon_name
(title: "Tab 3", icon: "system:apple.logo", view: AnyView(Text("Tab #22")))
])
}
}#Preview {
ContentView()
}
```**CustomTabContent - TabsContent.swift:**
```
import SwiftUIstruct CustomTabContent: View {
var body: some View {
Text("CustomTabContent")
.font(.title2)
Button(/*@START_MENU_TOKEN@*/"Button"/*@END_MENU_TOKEN@*/) {
/*@START_MENU_TOKEN@*//*@PLACEHOLDER=Action@*/ /*@END_MENU_TOKEN@*/
}
}
}
```**Key Moments:**
//OOTB icon from SF, system:sf_icon_name
(title: "Tab 1", **icon: "system:apple.logo"**, view: AnyView(CustomTabContent())),
//CUSTOM icon from Assets.xcassets
(title: "Tab 2", **icon: "iconFromAssets.xcassets"**, view: AnyView(Text("Tab #01"))),
//OOTB icon from SF, system:sf_icon_name
(title: "Tab 3", **icon: "system:apple.logo"**, view: AnyView(Text("Tab #22")))