The SwiftUIToolbox framework consists of a number of convenience views and utilities for use with SwiftUI.
See the LICENSE file for licensing information.
- Button Styles
- Colors
- Controls
- Fonts
- Modifiers
- Shapes
- UIKit Previews
- Utilities
- Utility Views
- Wrapped AppKit Views
- Wrapped UIKit Views
The ActionButtonStyle
is a ButtonStyle
that looks like the "Open" button in the App Store or TestFlight apps.
Button(action: { }) {
Text("Open")
}.buttonStyle(ActionButtonStyle())
The primary button style has a back plate with rounded corners.
The secondary button style has a light back plate with rounded corners.
A Color
extension that adds the iOS system colors from UIColor
.
Color.systemRed
Color.systemGreen
Color.secondaryLabel
Color.systemFill
A black view with 30% opacity (by default) that dims views behind it.
ZStack {
SomeContentView()
DimView(opacity: 0.3)
}
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()
}
}
A 1 pixel horizontal separator view.
HSeparator(color: .separator)
Emulates the UIKit page control.
PageDots(currentPage: 0, pageCount: 3)
The primary button has a back plate with rounded corners.
The secondary button has a light back plate with rounded corners.
A 1 pixel vertical separator view.
VSeparator(color: .separator)
The AllFontsView
is a list view that is available in DEBUG
builds that displays all the available system fonts.
AllFontsView()
Same as the mask
modifier, only inverted.
Prints a value and returns the unmodified view.
Triangle shape that points upwards.
Allows for objects that inherit from UIView
to be previewed in the SwiftUI preview window in Xcode.
Allows for objects that inherit from UIViewController
to be previewed in the SwiftUI preview window in Xcode.
Object that conforms to ObservableObject
for making simple search filters.
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)
Wrapper view for NSSearchField
.
Wrapper view for NSSearchField
specifically for use in the main siderbar.
Wrapper view for UIVisualEffectView
with blur effect
Blur(isPresented: $showBlur, style: .systemThinMaterial, animated: true)