Swiftpack.co -  apparata/SwiftUIToolbox as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
apparata/SwiftUIToolbox
A toolbox of various SwiftUI related code.
.package(url: "https://github.com/apparata/SwiftUIToolbox.git", from: "SwiftUI-2")

SwiftUIToolbox

The SwiftUIToolbox framework consists of a number of convenience views and utilities for use with SwiftUI.

License

See the LICENSE file for licensing information.

Table of Contents

Button Styles

ActionButtonStyle

The ActionButtonStyle is a ButtonStyle that looks like the "Open" button in the App Store or TestFlight apps.

Example

Button(action: { }) {
    Text("Open")
}.buttonStyle(ActionButtonStyle())

PrimaryButtonStyle

The primary button style has a back plate with rounded corners.

SecondaryButtonStyle

The secondary button style has a light back plate with rounded corners.

Colors

SystemColors

A Color extension that adds the iOS system colors from UIColor.

Example

Color.systemRed
Color.systemGreen
Color.secondaryLabel
Color.systemFill

Controls

DimView

A black view with 30% opacity (by default) that dims views behind it.

Example

ZStack {
    SomeContentView()
    DimView(opacity: 0.3)
}

EnumPicker

A convenience wrapper for Picker that makes it easier to use an enum for as the options.

The enum must conform to the Pickable protocol.

public typealias Pickable = CaseIterable
                          & Identifiable
                          & Hashable
                          & CustomStringConvertible

Example

enum Fruit: Pickable {
    case apple
    case banana
    case mango
    case orange
    case pear
    
    var id: Self { self }
    
    var description: String {
        switch self {
        case .apple: return "๐ŸŽ Apple"
        case .banana: return "๐ŸŒ Banana"
        case .mango: return "๐Ÿฅญ Mango"
        case .orange: return "๐ŸŠ Orange"
        case .pear: return "๐Ÿ Pear"
        }
    }
}

struct ExampleView: View {
    @State var selectedFruit: Fruit = .apple

    var body: some View {
        EnumPicker("Fruit", selection: $selectedFruit)
            .pickerStyle(SegmentedPickerStyle())
            .padding()
    }
}

HSeparator

A 1 pixel horizontal separator view.

Example

HSeparator(color: .separator)

PageDots

Emulates the UIKit page control.

Example

PageDots(currentPage: 0, pageCount: 3)

PrimaryButton

The primary button has a back plate with rounded corners.

SecondaryButton

The secondary button has a light back plate with rounded corners.

VSeparator

A 1 pixel vertical separator view.

VSeparator(color: .separator)

Fonts

AllFontsView

The AllFontsView is a list view that is available in DEBUG builds that displays all the available system fonts.

Example

AllFontsView()

Modifiers

inverseMask(...)

Same as the mask modifier, only inverted.

debugPrint(...)

Prints a value and returns the unmodified view.

Shapes

Triangle

Triangle shape that points upwards.

UIKit Previews

UIViewPreview

Allows for objects that inherit from UIView to be previewed in the SwiftUI preview window in Xcode.

UIViewControllerPreview

Allows for objects that inherit from UIViewController to be previewed in the SwiftUI preview window in Xcode.

Utilities

SearchFilter

Object that conforms to ObservableObject for making simple search filters.

Utility Views

Placeholder

The Placeholder view is a rounded rectangle with an optional title and the size of the view as a text label.

Example

Placeholder()
    .frame(width: 150, height: 100)

Wrapped AppKit Views

MacSearchField

Wrapper view for NSSearchField.

SidebarSearchField

Wrapper view for NSSearchField specifically for use in the main siderbar.

Wrapped UIKit Views

Blur

Wrapper view for UIVisualEffectView with blur effect

Example

Blur(isPresented: $showBlur, style: .systemThinMaterial, animated: true)

GitHub

link
Stars: 2
Last commit: 3 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jackโ€™d and SCRUFF. We are two of the worldโ€™s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Fix macOS build
12 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API