Introducing a collection of SwiftUI additions to make your projects easier to build.
Additionally, I hope this repo also serves as a great resource for how you to implement SwiftUI features 👍
Sponsor
Building useful libraries like these, takes time away from my family. I build these tools in my spare time because I feel its important to give back to the community. Please consider Sponsoring me as it helps keep me working on useful libraries like these 😬
You can also give me a follow and a ‘thanks’ anytime.
Additions
FittingGeometryReader
A GeometryReader that auto-sizes itself, enabling you to size your content automatically, while still gaining access to the proxy’s values like its runtime size.
Scrollable Stacks
VScrollStack – Wraps a VStack in a ScrollView while still respecting elements like Spacer
HScrollStack – Wraps an HStack in a ScrollView while still respecting elements like Spacer
TextSlider
A new text-based slider that provides gestural interactions via drag operations, as well as direct keyboard entry for more specific values. In addition it supports a styling API for custom designs.
VFlowStack
A vertical line-based stack view that lays out its children horizontally until they no longer fit at which point it begins “wrapping” the children onto a new line.
Similar to UICollectionViewFlowLayout
#
Haptics and Feedback
Supports various familiar animation-inspired APIs for attaching haptics and other feedback (audio, flash, etc) to state changes.
As a convenience the API provides haptic focused APIs.
withHaptic(.selection) { }
body.haptic(.selection) { }
However you can also use the withFeedback and feedback APIs to gain more control and access to other feedback methods. In particular you can combine methods to provide more complex feedback to the user.
SwiftUI Plus
Introducing a collection of SwiftUI additions to make your projects easier to build.
Sponsor
Building useful libraries like these, takes time away from my family. I build these tools in my spare time because I feel its important to give back to the community. Please consider Sponsoring me as it helps keep me working on useful libraries like these 😬
You can also give me a follow and a ‘thanks’ anytime.
Additions
FittingGeometryReader
A
GeometryReader
that auto-sizes itself, enabling you to size your content automatically, while still gaining access to the proxy’s values like its runtime size.Scrollable Stacks
VScrollStack
– Wraps aVStack
in aScrollView
while still respecting elements likeSpacer
HScrollStack
– Wraps anHStack
in aScrollView
while still respecting elements likeSpacer
TextSlider
A new text-based slider that provides gestural interactions via drag operations, as well as direct keyboard entry for more specific values. In addition it supports a styling API for custom designs.
VFlowStack
A vertical line-based stack view that lays out its children horizontally until they no longer fit at which point it begins “wrapping” the children onto a new line.
#
Haptics and Feedback
Supports various familiar animation-inspired APIs for attaching haptics and other feedback (audio, flash, etc) to state changes.
As a convenience the API provides
haptic
focused APIs.withHaptic(.selection) { }
body.haptic(.selection) { }
However you can also use the
withFeedback
andfeedback
APIs to gain more control and access to other feedback methods. In particular you can combine methods to provide more complex feedback to the user.Also note, the Feedback Audio APIs provide simplified access to almost all built-in audio files for your convenience.
Dependencies
This package automatically includes SwiftBackports and SwiftUIBackports to provide a richer set of APIs for all SwiftUI clients.
Installation
You can install manually (by copying the files in the
Sources
directory) or using Swift Package Manager (preferred)To install using Swift Package Manager, add this to the
dependencies
section of yourPackage.swift
file:.package(url: "https://github.com/shaps80/SwiftUIPlus.git", .upToNextMinor(from: "1.0.0"))