Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/QuynhNguyen/SlidingTabView
SwiftUI - Sliding Tab View
https://github.com/QuynhNguyen/SlidingTabView
Last synced: about 2 months ago
JSON representation
SwiftUI - Sliding Tab View
- Host: GitHub
- URL: https://github.com/QuynhNguyen/SlidingTabView
- Owner: QuynhNguyen
- Created: 2019-07-05T20:27:04.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-31T19:01:02.000Z (almost 2 years ago)
- Last Synced: 2024-11-17T10:16:55.599Z (about 2 months ago)
- Language: Swift
- Size: 10.7 KB
- Stars: 258
- Watchers: 2
- Forks: 34
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-swiftui-libraries - SlidingTabView - SwiftUI - Sliding Tab View (TabBar-and-Tabs / Content)
README
**SlidingTabView** is a simple Android-Like tab view that is built using the latest and greatest SwiftUI. Almost everything is customizable!
## Installation
Please use Swift Package Manager to install **SlidingTabView**## Usage
Just instantiate and bind it to your state. That is it!
```swift
@State private var selectedTabIndex = 0
SlidingTabView(selection: $selectedTabIndex,tabs: ["First Tab", "Second Tab"]
```## Canvas Preview
```swift
struct SlidingTabConsumerView : View {
@State private var selectedTabIndex = 0var body: some View {
VStack(alignment: .leading) {
SlidingTabView(selection: self.$selectedTabIndex, tabs: ["First", "Second"])
(selectedTabIndex == 0 ? Text("First View") : Text("Second View")).padding()
Spacer()
}
.padding(.top, 50)
.animation(.none)
}
}@available(iOS 13.0.0, *)
struct SlidingTabView_Previews : PreviewProvider {
static var previews: some View {
SlidingTabConsumerView()
}
}
```## Suggestions or feedback?
Feel free to create a pull request!