Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# SPAlert

**Popup from Apple Music & Feedback in AppStore**. Contains `Done`, `Heart`, `Error` and other presets. Support Dark Mode. I clone Apple's alerts as much as possible. You can find this alerts in AppStore after feedback and after added song to library in Apple Music.
**Popup from Apple Music & Feedback in AppStore**. Contains `Done`, `Heart`, `Error` and other presets. Supports Dark Mode. I tried to recreate Apple's alerts as much as possible. You can find these alerts in the AppStore after feedback and after you add a song to your library in Apple Music.

<p float="left">
<img src="https://github.com/ivanvorobei/SPAlert/blob/master/Assets/Readme/Preview%20-%20Done.gif" width="230">
<img src="https://github.com/ivanvorobei/SPAlert/blob/master/Assets/Readme/Preview%20-%20Heart.gif" width="230">
<img src="https://github.com/ivanvorobei/SPAlert/blob/master/Assets/Readme/Preview%20-%20Message.gif" width="230">
</p>

And other
And more:

<p float="left">
<img src="https://github.com/ivanvorobei/SPAlert/blob/master/Assets/Readme/Miniature%20-%20Doc.svg" width="50">
Expand All @@ -34,9 +34,9 @@ And other
<img src="https://github.com/ivanvorobei/SPAlert/blob/master/Assets/Readme/Miniature%20-%20Repeat.svg" width="50">
</p>

If you like the project, do not forget to `put star ★` and follow me on GitHub. To help project, see [Сooperation](#сooperation) section.
If you like the project, please do not forget to `star ★` this repository and follow me on GitHub. To help out with the project, see the [Сooperation](#сooperation) section.

Check example usage in app _Debts - Spending tracker_ for [iOS](https://itunes.apple.com/app/id1446635818) and [macOS](https://apps.apple.com/app/id1496914334). You can buy source code this apps in my store for iOS developers:
For an example of this plugin in use, check this app: _Debts - Spending tracker_ for [iOS](https://itunes.apple.com/app/id1446635818) and [macOS](https://apps.apple.com/app/id1496914334). You can buy source code this apps in my store for iOS developers:

[![xcode-shop.com](https://github.com/ivanvorobei/SPPermissions/blob/master/Assets/Buttons/xcode-shop.svg)](https://xcode-shop.com)
[![https://github.com/ivanvorobei](https://github.com/ivanvorobei/SPPermissions/blob/master/Assets/Buttons/follow-me-on-github.svg)](https://github.com/ivanvorobei)
Expand Down Expand Up @@ -98,31 +98,31 @@ If you prefer not to use any of dependency managers, you can integrate `SPAlert`

## Quick Start

For best experience, I recommend call alerts by `SPAlert`. These functions are updated regularly and show as Apple way. I focus on presets:
For best experience, I recommend presenting the alerts by calling the class functions on `SPAlert`. These functions are updated regularly and show the alerts "the Apple way". I focus on presets:

```swift
SPAlert.present(title: "Added to Library", preset: .done)
```

If you want use custom image, use func:
For using a custom image:

```swift
SPAlert.present(title: "Love", message: "We'll recommend more like this in For You", image: UIImage(named: "Heart")!)
```

For show simple text message, use:
For showing a simple text message:

```swift
SPAlert.present(message: "Empty UITextField")
SPAlert.present(message: "Text!")
```

## Usage

Sometimes it may require deep customization. In this section, I will show you what you can do.
If you require deep customization, this section will show you what you can do.

### Duration

To change the time that the `SPAlert` will be shown, use property `duration`:
If you want the `SPAlert` to be shwon longer, use the `duration` property:

```swift
let alertView = SPAlertView(title: "Added to Library", message: nil, preset: SPAlertPreset.done)
Expand All @@ -134,61 +134,60 @@ alertView.present()

<img align="left" src="https://github.com/ivanvorobei/SPAlert/blob/master/Assets/Readme/Preview%20-%20DarkMode.jpg" width="220">

Dark Mode no need additional configuration. As soon as the user change the interface to dark, all alerts will appear dark.
Dark Mode needs no additional configuration. As soon as the user changes their interface to dark, all alerts will follow suit.

For check state of user appearance I am use `traitCollection`:
This is achieved by checking the `userInterfaceStyle` property on `traitCollection`.:

```swift
if self.traitCollection.userInterfaceStyle == .dark {
return true
}
```

It available since iOS 12, for early using always Light Mode.
It is available since iOS 12, for earlier iOS versions the alerts will always be shown in Light Mode.

### Layout

Here you can change the sizes and spaces:
To change the size and spacing of the alerts:

```swift
alertView.layout.topSpace = 18
alertView.layout.iconHeight = 25
```

For more properties see class.
For more properties see the class.

### Dismiss by Tap

If you click on the alert, it will disappear ahead of time. This can be disabled:
If you tap the alert, it will disappear ahead of time. This can be disabled:

```swift
alertView.dismissByTap = false
```

### Haptic

If you use presets, the vibro-response will be start automatically. For customize this, you need set property `haptic`:
If you use presets, the vibro-response will be started automatically. To customize this, you need set the `haptic` property:

```swift
alertView.haptic = .success
```

For disable haptic, set it to `.none`.
To disable haptics, set it to `.none`.

### Corner Radius

I use a corner radius like an Apple. If you need to change it, see the property `cornerRadius`:
You can change the corner radius by setting the `cornerRadius` property:

```swift
alertView.layer.cornerRadius = 40
```

## Сooperation

The development of this project is completely free. If you can make a contribution, it will help development. Here list of task what need do:
This project is free to use, but developing it takes time. Contributing to this project is a huge help. Here is list of tasks that need to be done:

- Fix mistakes in this Readme and docs. My English so bad. Good create pull request.
- Add docs in source files. Description of public methods and parametrs.
- Add documentation in the source files (description of public methods and parameters).
- Help me translate my app [Debts - Spending tracker](https://itunes.apple.com/app/id1446635818) for other languages.

## License
Expand Down