Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jasudev/axissegmentedview
A library that allows you to easily create various styles of segmented views. Supports iOS, macOS and tvOS.
https://github.com/jasudev/axissegmentedview
ios macos segment segment-tree segmentation segmented segmented-controls segmented-view segmentedcontrol segmentedview segments swift swiftui tabbar tabview tvos tvos-framework tvos-library
Last synced: 2 months ago
JSON representation
A library that allows you to easily create various styles of segmented views. Supports iOS, macOS and tvOS.
- Host: GitHub
- URL: https://github.com/jasudev/axissegmentedview
- Owner: jasudev
- License: mit
- Created: 2022-03-26T18:07:47.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-27T04:53:26.000Z (over 2 years ago)
- Last Synced: 2024-12-12T06:55:07.108Z (2 months ago)
- Topics: ios, macos, segment, segment-tree, segmentation, segmented, segmented-controls, segmented-view, segmentedcontrol, segmentedview, segments, swift, swiftui, tabbar, tabview, tvos, tvos-framework, tvos-library
- Language: Swift
- Homepage:
- Size: 1.19 MB
- Stars: 179
- Watchers: 3
- Forks: 16
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# **AxisSegmentedView for SwiftUI**
A library that allows you to easily create various styles of segmented views. Supports iOS, macOS and tvOS.[](https://developer.apple.com/macOS)
[](https://developer.apple.com/iOS)
[](https://developer.apple.com/macOS)
[](https://developer.apple.com/tvOS)
[](https://www.instagram.com/dev.fabula)
[](https://developer.apple.com/documentation/swift_packages/package/)
[](https://opensource.org/licenses/MIT)## Screenshot
|Horizontal|Vertical|For use without style|
|:---:|:---:|:---:|
||
|
|
https://user-images.githubusercontent.com/1617304/160249891-a2fe15f2-5b07-4c2c-a204-fa9bd8981989.mov
## Example
[https://fabulaapp.page.link/234](https://fabulaapp.page.link/234)## Usages
```swift
AxisSegmentedView(selection: $selection, constant: .init()) {
Image(systemName: "align.horizontal.left")
.itemTag(0, selectArea: 0) {
Image(systemName: "align.horizontal.left.fill")
}
Image(systemName: "align.horizontal.right")
.itemTag(1, selectArea: 160) {
Image(systemName: "align.horizontal.right.fill")
}
Image(systemName: "align.vertical.top")
.itemTag(2, selectArea: 0) {
Image(systemName: "align.vertical.top.fill")
}
Image(systemName: "align.vertical.bottom")
.itemTag(3, selectArea: 160) {
Image(systemName: "align.vertical.bottom.fill")
}
} style: {
ASBasicStyle()
} onTapReceive: { selectionTap in
/// Imperative syntax
print("---------------------")
print("Selection : ", selectionTap)
print("Already selected : ", self.selection == selectionTap)
}
.frame(height: 44)
```## Usages - For use without style
```swift
var listView: some View {
List(0...100, id: \.self) { index in
Button {
print("click")
} label: {
Text("Index \(index)")
}
}.listStyle(.plain)
}
AxisSegmentedView(selection: $selection, constant: .init()) {
Rectangle()
.overlay(
Text("0")
)
.itemTag(0, selectArea: maxArea1) {
Rectangle()
.overlay(
Text("0")
)
}
Rectangle()
.overlay(
Text("1")
)
.itemTag(1, selectArea: maxArea1) {
listView
}
Rectangle()
.overlay(
Text("2")
)
.itemTag(2, selectArea: maxArea1) {
listView
}
Rectangle()
.overlay(
Text("3")
)
.itemTag(3, selectArea: maxArea1) {
listView
}
}
```
## Swift Package Manager
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. Once you have your Swift package set up, adding AxisSegmentedView as a dependency is as easy as adding it to the dependencies value of your Package.swift.```swift
dependencies: [
.package(url: "https://github.com/jasudev/AxisSegmentedView.git", .branch("main"))
]
```## Contact
instagram : [@dev.fabula](https://www.instagram.com/dev.fabula)
email : [[email protected]](mailto:[email protected])## License
AxisSegmentedView is available under the MIT license. See the [LICENSE](LICENSE) file for more info.