Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/talljack/cooponent
🎨 A collection of beautiful, customizable SwiftUI components for modern iOS and macOS applications. Built with SwiftUI, focusing on reusability and user experience.
https://github.com/talljack/cooponent
ios swift swiftui ui-components
Last synced: 8 days ago
JSON representation
🎨 A collection of beautiful, customizable SwiftUI components for modern iOS and macOS applications. Built with SwiftUI, focusing on reusability and user experience.
- Host: GitHub
- URL: https://github.com/talljack/cooponent
- Owner: Talljack
- License: mit
- Created: 2024-12-26T15:36:54.000Z (26 days ago)
- Default Branch: main
- Last Pushed: 2024-12-26T15:50:34.000Z (26 days ago)
- Last Synced: 2025-01-13T03:33:02.464Z (9 days ago)
- Topics: ios, swift, swiftui, ui-components
- Language: Swift
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cooponent
A collection of beautiful and reusable SwiftUI components.
## Features
- **SegmentedControl**: A highly customizable segmented control component that supports both text and icon modes.
## Requirements
- iOS 15.0+ / macOS 13.0+
- Swift 5.7+
- Xcode 14.0+## Installation
### Swift Package Manager
Add the following line to the dependencies in your `Package.swift` file:
```swift
.package(url: "https://github.com/Talljack/Cooponent.git", from: "1.0.0")
```Then include "Cooponent" as a dependency for your target:
```swift
.target(
name: "YourTarget",
dependencies: ["Cooponent"]
)
```## Usage
### SegmentedControl
```swift
import SwiftUI
import Cooponentstruct ContentView: View {
enum Tab: String, SegmentItem {
case home = "house.fill"
case search = "magnifyingglass"
case profile = "person.fill"
case settings = "gear"
}
@State private var selectedTab: Tab = .home
var body: some View {
// Default style with icons
SegmentedControl(
tabs: [.home, .search, .profile, .settings],
activeTab: $selectedTab,
activeTint: Color.blue,
inactiveTint: Color.gray
) { size in
Capsule()
.fill(Color.blue.opacity(0.2))
}
.frame(height: 50)
// Text mode
SegmentedControl(
tabs: [.home, .search, .profile, .settings],
activeTab: $selectedTab,
displayAsText: true,
font: .headline,
activeTint: Color.white,
inactiveTint: Color.gray
) { size in
RoundedRectangle(cornerRadius: 10)
.fill(Color.blue)
}
.frame(height: 45)
}
}
```## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.