The SwiftUIToolbox framework consists of a number of convenience views and utilities for use with SwiftUI.
See the LICENSE file for licensing information.
ActionButtonStyle
The ActionButtonStyle
is a ButtonStyle
that looks like the "Open" button in the App Store or TestFlight apps.
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.
SystemColors
A Color
extension that adds the iOS system colors from UIColor
.
Color.systemRed
Color.systemGreen
Color.secondaryLabel
Color.systemFill
DimView
A black view with 30% opacity (by default) that dims views behind it.
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
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.
HSeparator(color: .separator)
PageDots
Emulates the UIKit page control.
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)
AllFontsView
The AllFontsView
is a list view that is available in DEBUG
builds that displays all the available system fonts.
AllFontsView()
inverseMask(...)
Same as the mask
modifier, only inverted.
debugPrint(...)
Prints a value and returns the unmodified view.
Triangle
Triangle shape that points upwards.
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.
SearchFilter
Object that conforms to ObservableObject
for making simple search filters.
Placeholder
The Placeholder
view is a rounded rectangle with an optional title and the size of the view as a text label.
Placeholder()
.frame(width: 150, height: 100)
MacSearchField
Wrapper view for NSSearchField
.
SidebarSearchField
Wrapper view for NSSearchField
specifically for use in the main siderbar.
Blur
Wrapper view for UIVisualEffectView
with blur effect
Blur(isPresented: $showBlur, style: .systemThinMaterial, animated: true)
link |
Stars: 6 |
Last commit: 1 week ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics