From 7d06faf90ac8b1645c3528e892b1ef05f9dd14aa Mon Sep 17 00:00:00 2001 From: Josh Hrach Date: Fri, 5 Jun 2020 22:50:20 -0700 Subject: [PATCH] Update README.md Added notes on new view modifier functions under Usage --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 283f824..5dc3123 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,36 @@ Install `ActivityIndicatorView` into your project using `Swift Package Manager`. In your SwiftUI `.swift` file, add `import ActivityIndicatorView`. +To use, simply add the view where you would like it to appear. + +```swift +// Example view +HStack { + // Your content + ... + + // Show indicator next to your content + ActivityIndicatorView() +} +``` + +### Modifier + +You can easily add an activity indicator to your view similar to how you would add an `Alert` or `ActionSheet`. This will overlay an activity indicator with a maximum frame size of 50 by 50. On iOS, this will appear similar to the default size of `UIActivityIndicatorView`. When overlaid over smaller views, the activity indicator will automatically resize smaller to fit the frame. + +```swift +// Examples +// Add a default indicator. +.activityIndicator(isVisible: true) + +// Add a custom indicator +.activityIndicator(isVisible: true) { + ActivityIndicatorView(foregroundColor: .green, backgroundColor: .black) +} +``` + +## Appearance + ### Basic You can add the view directly without customization. This will produce a view identical to `UIActivityIndicatorView`.