Skip to content

Commit

Permalink
chore: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gtokman committed Apr 24, 2021
1 parent b4e0e61 commit e117767
Show file tree
Hide file tree
Showing 7 changed files with 300 additions and 28 deletions.
3 changes: 2 additions & 1 deletion Documentation/Reference/ExtensionKit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [CFRunLoopTimer](extensions/CFRunLoopTimer.md)
- [CGPoint](extensions/CGPoint.md)
- [CGRect](extensions/CGRect.md)
- [Color](extensions/Color.md)
- [Data](extensions/Data.md)
- [Date](extensions/Date.md)
- [FileManager](extensions/FileManager.md)
Expand All @@ -36,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 17:16:56 +0000
This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) on 2021-04-24 19:31:50 +0000
12 changes: 0 additions & 12 deletions Documentation/Reference/ExtensionKit/extensions/CGRect.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,6 @@ var leftMiddle: CGPoint
var rightMiddle: CGPoint
```

### `midX`

```swift
var midX: CGFloat
```

### `midY`

```swift
var midY: CGFloat
```

### `center`

```swift
Expand Down
70 changes: 70 additions & 0 deletions Documentation/Reference/ExtensionKit/extensions/Color.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
**EXTENSION**

# `Color`
```swift
public extension Color
```

## Methods
### `init(hex:)`

```swift
init(hex: String)
```

Initialize with HEX
- Parameter hex: HEX

#### Parameters

| Name | Description |
| ---- | ----------- |
| hex | HEX |

### `random(opacity:)`

```swift
static func random(opacity: CGFloat = 1.0) -> Color
```

Generate a random color
- Parameter opacity: opacity
- Returns: New color

#### Parameters

| Name | Description |
| ---- | ----------- |
| opacity | opacity |

### `lighten(by:)`

```swift
func lighten(by percentage: CGFloat = 30.0) -> Color
```

Lighten color
- Parameter percentage: percentage (1 -100), default: 30
- Returns: new color

#### Parameters

| Name | Description |
| ---- | ----------- |
| percentage | percentage (1 -100), default: 30 |

### `darken(by:)`

```swift
func darken(by percentage: CGFloat = 30.0) -> Color
```

Darken color
- Parameter percentage: percentage (1 -100), default: 30
- Returns: new color

#### Parameters

| Name | Description |
| ---- | ----------- |
| percentage | percentage (1 -100), default: 30 |
50 changes: 49 additions & 1 deletion Documentation/Reference/ExtensionKit/extensions/UIColor.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,52 @@ Color from HEX

| Name | Description |
| ---- | ----------- |
| hexCode | Hex w/o `#` |
| hexCode | Hex w/o `#` |

### `random(alpha:)`

```swift
static func random(alpha: CGFloat = 1.0) -> UIColor
```

Random color
- Parameter alpha: alpha
- Returns: new color

#### Parameters

| Name | Description |
| ---- | ----------- |
| alpha | alpha |

### `lighten(by:)`

```swift
func lighten(by percentage: CGFloat = 30.0) -> UIColor
```

Darken color
- Parameter percentage: percentage
- Returns: new color

#### Parameters

| Name | Description |
| ---- | ----------- |
| percentage | percentage |

### `darken(by:)`

```swift
func darken(by percentage: CGFloat = 30.0) -> UIColor
```

Darken color
- Parameter percentage: percentage
- Returns: new color

#### Parameters

| Name | Description |
| ---- | ----------- |
| percentage | percentage |
49 changes: 49 additions & 0 deletions Documentation/Reference/ExtensionKit/extensions/UIView.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,52 @@ func shakeToIndicateError()
```

Commit a shake animation and vibrate to indicate the occured error.

### `dropRealShadow(shadowColor:fillColor:opacity:offset:radius:)`

```swift
func dropRealShadow(shadowColor: UIColor = UIColor.black, fillColor: UIColor = UIColor.white, opacity: Float = 0.2, offset: CGSize = CGSize(width: 0.0, height: 1.0), radius: CGFloat = 10) -> CAShapeLayer
```

New drop shadow by adding new layer
- Parameters:
- shadowColor: color
- fillColor: fill default: white
- opacity: opacity default 20%
- offset: offset default y: 1
- radius: radius (blur) default 10
- Returns: new layer

#### Parameters

| Name | Description |
| ---- | ----------- |
| shadowColor | color |
| fillColor | fill default: white |
| opacity | opacity default 20% |
| offset | offset default y: 1 |
| radius | radius (blur) default 10 |

### `dropShadow(color:opacity:offSet:radius:scale:)`

```swift
func dropShadow(color: UIColor, opacity: Float = 0.5, offSet: CGSize, radius: CGFloat = 1, scale: Bool = true)
```

Draw a simple drop shadow for the views layer
- Parameters:
- color: color
- opacity: opacity default: 50%
- offSet: offset
- radius: radius (blur) default 1
- scale: scale default: true

#### Parameters

| Name | Description |
| ---- | ----------- |
| color | color |
| opacity | opacity default: 50% |
| offSet | offset |
| radius | radius (blur) default 1 |
| scale | scale default: true |
108 changes: 107 additions & 1 deletion Documentation/Reference/ExtensionKit/extensions/View.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,110 @@ Fill parent view

| Name | Description |
| ---- | ----------- |
| alignment | alignment |
| alignment | alignment |

### `if(_:transform:)`

```swift
func `if`<Transform: View>(_ condition: Bool, transform: (Self) -> Transform) -> some View
```

If a condition is true, transform and return a new view
- Parameters:
- condition: condition
- transform: transformation if true
- Returns: new view

#### Parameters

| Name | Description |
| ---- | ----------- |
| condition | condition |
| transform | transformation if true |

### `if(_:if:else:)`

```swift
func `if`<TrueContent: View, FalseContent: View>(
_ condition: Bool,
if ifTransform: (Self) -> TrueContent,
else elseTransform: (Self) -> FalseContent
) -> some View
```

If a condition is true, transform and return a new view
- Parameters:
- condition: condition
- ifTransform: true case transform
- elseTransform: else case transform
- Returns: new view

#### Parameters

| Name | Description |
| ---- | ----------- |
| condition | condition |
| ifTransform | true case transform |
| elseTransform | else case transform |

### `embedInNavigationView()`

```swift
func embedInNavigationView() -> some View
```

Embed Self in `NavigationView`
- Returns: New view with `NavigationView` parent

### `cornerRadius(_:corners:)`

```swift
func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View
```

Round view with specific corners
- Parameters:
- radius: radius
- corners: corners to round
- Returns: new rounded view

#### Parameters

| Name | Description |
| ---- | ----------- |
| radius | radius |
| corners | corners to round |

### `debug()`

```swift
func debug() -> Self
```

Debug print view representation
- Returns: Self after printing

### `eraseToAnyView()`

```swift
func eraseToAnyView() -> AnyView
```

Erase view to `AnyView`
- Returns: new view

### `hidden(_:)`

```swift
func hidden(_ hidden: Bool) -> some View
```

Hides the view conditionally
- Parameter hidden: is hidden
- Returns: hidden view but not drawn on screen

#### Parameters

| Name | Description |
| ---- | ----------- |
| hidden | is hidden |
36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,41 @@

<img alt="Petrify 2021-04-24 at 10 48 09 AM" src="https://user-images.githubusercontent.com/12258850/115962682-92600180-a4ea-11eb-9906-58ae6baed325.png">

#### A collection of UIKit and SwiftUI extensions to speed up app development

# Reference Documentation
# Documentation

## Extensions

### SwiftUI

- [View](Documentation/Reference/ExtensionKit/extensions/View.md)
- [Color](Documentation/Reference/ExtensionKit/extensions/Color.md)

### UIKit

- [UIApplication](Documentation/Reference/ExtensionKit/extensions/UIApplication.md)
- [UIButton](Documentation/Reference/ExtensionKit/extensions/UIButton.md)
- [UIColor](Documentation/Reference/ExtensionKit/extensions/UIColor.md)
- [UIImage](Documentation/Reference/ExtensionKit/extensions/UIImage.md)
- [UITableView](Documentation/Reference/ExtensionKit/UITableView.md)
- [UIView](Documentation/Reference/ExtensionKit/UIView.md)
- [UIViewController](Documentation/Reference/ExtensionKit/UIViewController.md)

### Foundation

- [Array](Documentation/Reference/ExtensionKit/extensions/Array.md)
- [CFRunLoopTimer](Documentation/Reference/ExtensionKit/extensions/CFRunLoopTimer.md)
- [CGPoint](Documentation/Reference/ExtensionKit/extensions/CGPoint.md)
- [CGRect](Documentation/Reference/ExtensionKit/extensions/CGRect.md)
- [Data](Documentation/Reference/ExtensionKit/extensions/Data.md)
- [Date](Documentation/Reference/ExtensionKit/extensions/Date.md)
- [FileManager](Documentation/Reference/ExtensionKit/extensions/FileManager.md)
- [Int](Documentation/Reference/ExtensionKit/extensions/Int.md)
- [NSObject](Documentation/Reference/ExtensionKit/extensions/NSObject.md)
- [String](Documentation/Reference/ExtensionKit/extensions/String.md)
- [Timer](Documentation/Reference/ExtensionKit/extensions/Timer.md)
- [UIApplication](Documentation/Reference/ExtensionKit/extensions/UIApplication.md)
- [UIButton](Documentation/Reference/ExtensionKit/extensions/UIButton.md)
- [UIColor](Documentation/Reference/ExtensionKit/extensions/UIColor.md)
- [UIImage](Documentation/Reference/ExtensionKit/extensions/UIImage.md)
- [UITableView](Documentation/Reference/ExtensionKit/extensions/UITableView.md)
- [UIView](Documentation/Reference/ExtensionKit/extensions/UIView.md)
- [UIViewController](Documentation/Reference/ExtensionKit/extensions/UIViewController.md)
- [View](Documentation/Reference/ExtensionKit/extensions/View.md)

### CoreGraphics

- [CGPoint](Documentation/Reference/ExtensionKit/extensions/CGPoint.md)
- [CGRect](Documentation/Reference/ExtensionKit/extensions/CGRect.md)

## Methods

Expand Down

0 comments on commit e117767

Please sign in to comment.