From 2aa442491b85a530d3b9ce079a0c2538cbae1861 Mon Sep 17 00:00:00 2001 From: Gary Tokman Date: Sun, 25 Apr 2021 01:39:03 -0400 Subject: [PATCH] chore: update docs --- .../Reference/ExtensionKit/README.md | 2 +- .../ExtensionKit/extensions/Timer.md | 2 +- .../Reference/ExtensionKit/extensions/View.md | 66 ++++++++++++++++++- Sources/ExtensionKit/SwiftUI/Color.swift | 1 + .../ExtensionKit/SwiftUI/RoundedCorner.swift | 1 + .../ExtensionKit/SwiftUI/ShimmerView.swift | 1 + Sources/ExtensionKit/SwiftUI/View.swift | 2 +- 7 files changed, 71 insertions(+), 4 deletions(-) diff --git a/Documentation/Reference/ExtensionKit/README.md b/Documentation/Reference/ExtensionKit/README.md index d330435..adbd8dd 100644 --- a/Documentation/Reference/ExtensionKit/README.md +++ b/Documentation/Reference/ExtensionKit/README.md @@ -37,4 +37,4 @@ - [dprint(__)](methods/dprint(__).md) - [sleep(duration_)](methods/sleep(duration_).md) -This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) on 2021-04-24 19:31:50 +0000 \ No newline at end of file +This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) on 2021-04-25 05:38:11 +0000 \ No newline at end of file diff --git a/Documentation/Reference/ExtensionKit/extensions/Timer.md b/Documentation/Reference/ExtensionKit/extensions/Timer.md index 950ca3a..828a5fa 100644 --- a/Documentation/Reference/ExtensionKit/extensions/Timer.md +++ b/Documentation/Reference/ExtensionKit/extensions/Timer.md @@ -35,6 +35,6 @@ class func schedule(repeatInterval interval: TimeInterval, handler: @escaping () Schedule closure to run on main run loop and repeat at the interval - Parameters: - - interval: 触发时长,从现在开始经过interval时长后触发第一次 + - interval: Interval - handler: Closure to run - Returns: CFRunLoopTimer diff --git a/Documentation/Reference/ExtensionKit/extensions/View.md b/Documentation/Reference/ExtensionKit/extensions/View.md index e374999..4c09996 100644 --- a/Documentation/Reference/ExtensionKit/extensions/View.md +++ b/Documentation/Reference/ExtensionKit/extensions/View.md @@ -22,6 +22,24 @@ Fill parent view | ---- | ----------- | | alignment | alignment | +### `fillWidth()` + +```swift +func fillWidth() -> some View +``` + +Fill parent's width +- Returns: view + +### `fillHeight()` + +```swift +func fillHeight() -> some View +``` + +Fill parent's height +- Returns: view + ### `if(_:transform:)` ```swift @@ -126,4 +144,50 @@ Hides the view conditionally | Name | Description | | ---- | ----------- | -| hidden | is hidden | \ No newline at end of file +| hidden | is hidden | + +### `shimmer(isActive:speed:angle:)` + +```swift +func shimmer( + isActive: Bool = true, + speed: Double = 0.15, + angle: Angle = .init(degrees: 70) +) -> some View +``` + +Loading shimmer animation on view +- Parameters: + - isActive: is shimmer animation active + - speed: speed, default: 0.15 + - angle: angle of animation, default: 70º +- Returns: View + +#### Parameters + +| Name | Description | +| ---- | ----------- | +| isActive | is shimmer animation active | +| speed | speed, default: 0.15 | +| angle | angle of animation, default: 70º | + +### `addBorder(_:width:cornerRadius:)` + +```swift +func addBorder(_ content: S, width: CGFloat = 1, cornerRadius: CGFloat) -> some View where S: ShapeStyle +``` + +Overlay border on view +- Parameters: + - content: ShapeStyle view + - width: border width + - cornerRadius: corner radius +- Returns: view + +#### Parameters + +| Name | Description | +| ---- | ----------- | +| content | ShapeStyle view | +| width | border width | +| cornerRadius | corner radius | \ No newline at end of file diff --git a/Sources/ExtensionKit/SwiftUI/Color.swift b/Sources/ExtensionKit/SwiftUI/Color.swift index dcb5cdf..928426b 100644 --- a/Sources/ExtensionKit/SwiftUI/Color.swift +++ b/Sources/ExtensionKit/SwiftUI/Color.swift @@ -4,6 +4,7 @@ import SwiftUI #endif +@available(iOS 13.0, macOS 10.15, *) public extension Color { /// Initialize with HEX diff --git a/Sources/ExtensionKit/SwiftUI/RoundedCorner.swift b/Sources/ExtensionKit/SwiftUI/RoundedCorner.swift index 702343b..7b6aa8b 100644 --- a/Sources/ExtensionKit/SwiftUI/RoundedCorner.swift +++ b/Sources/ExtensionKit/SwiftUI/RoundedCorner.swift @@ -4,6 +4,7 @@ import SwiftUI #endif +@available(iOS 13.0, macOS 10.15, *) struct RoundedCorner: Shape { var radius: CGFloat = .infinity var corners: UIRectCorner = .allCorners diff --git a/Sources/ExtensionKit/SwiftUI/ShimmerView.swift b/Sources/ExtensionKit/SwiftUI/ShimmerView.swift index 6e15d96..29506ea 100644 --- a/Sources/ExtensionKit/SwiftUI/ShimmerView.swift +++ b/Sources/ExtensionKit/SwiftUI/ShimmerView.swift @@ -5,6 +5,7 @@ import SwiftUI #endif /// View with linear gradient shimmer animation +@available(iOS 13.0, macOS 10.15, *) struct ShimmerView: View { @State var show: Bool = false diff --git a/Sources/ExtensionKit/SwiftUI/View.swift b/Sources/ExtensionKit/SwiftUI/View.swift index 4847815..7974653 100644 --- a/Sources/ExtensionKit/SwiftUI/View.swift +++ b/Sources/ExtensionKit/SwiftUI/View.swift @@ -4,7 +4,7 @@ import SwiftUI #endif -@available(iOS 13.0, *) +@available(iOS 13.0, macOS 10.15, *) public extension View { /// Fill parent view