https://github.com/devliusir/lcslidetounlock
A simple slide to unlock iOS UI component.
https://github.com/devliusir/lcslidetounlock
ios-animation ios-demo slider slideshow swift5-1 unlock unlocker
Last synced: 5 months ago
JSON representation
A simple slide to unlock iOS UI component.
- Host: GitHub
- URL: https://github.com/devliusir/lcslidetounlock
- Owner: DevLiuSir
- License: mit
- Created: 2018-02-25T10:08:21.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-10-16T13:53:39.000Z (over 4 years ago)
- Last Synced: 2024-10-31T15:44:14.549Z (6 months ago)
- Topics: ios-animation, ios-demo, slider, slideshow, swift5-1, unlock, unlocker
- Language: Swift
- Homepage:
- Size: 4.4 MB
- Stars: 10
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
LCSlideToUnlock is a simple slide to unlock iOS UI component.

[](https://developer.apple.com/swift/)

[](#cocoapods)











[](https://twitter.com/LiuChuan_)---
## Requirements
- iOS 13+
- Xcode 11+
- Swift 5.1+## Screencast
![]()
## Effect of collection
- **Using enumerations to define `LCSlideToUnlock` animation types**
```swift
/// 动画方向
///
/// - horizontal: 水平
/// - vertical: 垂直
/// - diagonalUp: 对角线往上
/// - diagonalDown: 对角线往下
public enum AnimationDirection {
case horizontal
case vertical
case diagonalUp
case diagonalDown
}
```## Design
|  |  |  |  |
| :------------: | :------------: | :------------: | :------------: |
| `horizontal` | `vertical` | `diagonalUp` | `diagonalDown` |## Attribute
| Attribute name | Specific introduction of attributes |
| :------------: | :------------: |
| `textStr ` | LCSlideToUnlock of text |
| `textColor` | LCSlideToUnlock text color |
| `isEnableAutoreverses` | Whether to turn on and back animation |
| `shimmerImage` | Gradient picture (You can only set one with `shimmerColors`) |
| `shimmerColors` | The gradient color group (at least two elements, only one with `shimmerImage`) |## Installation
[CocoaPods](http://cocoapods.org/) is a dependency manager for Cocoa projects. You can install it with the following command:
```swift
$ gem install cocoapods
```Just add the `LCSlideToUnlock` folder to your project.
or use `CocoaPods` with Podfile:
```swift
pod 'LCSlideToUnlock'
```You can use CocoaPods to install `LCSlideToUnlock` by adding it to your Podfile:
```swift
platform :ios, '12.0'
target '' do
use_frameworks!
pod 'LCSlideToUnlock'
end
```Then, run the following command:
```swift
$ pod install
```## Example:
```swift
import UIKit
import LCSlideToUnlockclass ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
/******* LCSlideToUnlockView *******/
let slideToUnlockView = LCSlideToUnlockView(frame: CGRect(x: 0, y: view.bounds.height - 100, width: view.bounds.width, height: 40))
slideToUnlockView.textStr = "> Slide To Unlock "
slideToUnlockView.textColor = .black
slideToUnlockView.shimmerColors = [.white, .white]
//slideToUnlockView.shimmerImage = UIImage(named: "gradient")
slideToUnlockView.font = UIFont.systemFont(ofSize: 20)
slideToUnlockView.animationDirection = .horizontal
slideToUnlockView.isEnableAutoreverses = false
slideToUnlockView.showFadeWithDuration(4)
view.addSubview(slideToUnlockView)
}
}
```