Swiftpack.co - Package - gerardogrisolini/CubeUI
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

CubeUI

Getting Started

Adding a dependencies clause to your Package.swift

dependencies: [
    .package(url: "https://github.com/gerardogrisolini/CubeUI.git", from: "1.1.4")
]

Example

import SwiftUI
import CubeUI

struct SideView: View {
    var number: Int
    var color: Color
    
    var body: some View {
        Text("Content \(number)")
            .frame(maxWidth: .infinity, maxHeight: .infinity)
            .background(color)
    }
}

struct ContentView: View {
    @State private var index: Int = 0
    
    var body: some View {
        CubeView(index: $index, mode: .drag) {
            SideView(number: 1, color: .blue)
            SideView(number: 2, color: .orange)
            SideView(number: 3, color: .green)
            SideView(number: 4, color: .yellow)
        }
        .toolbar {
            ToolbarItem(placement: .primaryAction) {
                Button(action: { index = 0 }) {
                    Image(systemName: "line.horizontal.3")
                }
            }
        }
    }
}

Github

link
Stars: 0